Re: Creating first database - Mailing list pgsql-docs

From David G. Johnston
Subject Re: Creating first database
Date
Msg-id CAKFQuwZLs+CfXvwtrDc3SAwVfM=cRS17eN15sbvrhPOzZHgpTw@mail.gmail.com
Whole thread Raw
In response to Creating first database  (PG Doc comments form <noreply@postgresql.org>)
List pgsql-docs
On Friday, March 28, 2025, PG Doc comments form <noreply@postgresql.org> wrote:
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.

The database has to have a user created during install in order to work.  Usually that is “postgres” and the installer is considerate enough to ensure your operating system also has a user of the same name.  You need to become that OS user initially in order to get into the clean post-install system.  And which point you can create users and databases that align with your desired interaction.  And to also modify the configuration files which are owned by that created (usually postgres) OS user.

David J.

pgsql-docs by date:

Previous
From: Robert Treat
Date:
Subject: Re: Documentation for initdb option --waldir
Next
From: "Gurjeet Singh"
Date:
Subject: Re: Creating first database