Re: Creating first database

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "postgresql(at)complexity(dot)com(dot)au" <postgresql(at)complexity(dot)com(dot)au>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Creating first database
Date: 2025-03-29 14:48:36
Message-ID: CAKFQuwZLs+CfXvwtrDc3SAwVfM=cRS17eN15sbvrhPOzZHgpTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Friday, March 28, 2025, PG Doc comments form <noreply(at)postgresql(dot)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.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Gurjeet Singh 2025-03-29 14:56:48 Re: Creating first database
Previous Message Robert Treat 2025-03-29 14:26:49 Re: Documentation for initdb option --waldir