Creating first database

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: postgresql(at)complexity(dot)com(dot)au
Subject: Creating first database
Date: 2025-03-29 06:19:24
Message-ID: 174322916469.674.13909966511923455324@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/tutorial-createdb.html
Description:

In the Getting Started section of the documentation which would be used by a
new user immediately after installing PostgreSQL, the user is asked to run
$ createdb mydb
If the database is correctly installed, this first command to be run by the
new user inevitably fails with the error:
createdb: error: connection to server at "localhost" (::1), port 5432
failed: FATAL: password authentication failed for user "Mark"

The reason it fails by my understanding is because the installation process
does not create any user and without a user specified on createdb PostgreSQL
is defaulting to using the OS user name. Since this does not exist in
PostgreSQL the access is denied with the incorrect error message above. The
error message suggests that there is a password issue but the real issue is
that PostgreSQL has defaulted to a user that does not exist in PostgreSQL.
This is a disappointing start for a new user. It would be better to explain
this to the user and take them through the user creation process rather than
letting them struggle and Google the issue as I did. I think the typical
user would assume that they should be using their OS user password and then
wonder why that doesn't work.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2025-03-29 13:56:10 Re: Creating first database
Previous Message David G. Johnston 2025-03-27 21:56:28 Re: Documentation for initdb option --waldir