PostgreSQL setup and use

Gordon Messmer yinyang at
Thu Jul 16 08:54:45 UTC 2009

On 07/15/2009 11:43 PM, Brad Pepers wrote:
> 2. So now I have it installed and I try to create a database using
> createdb. I'm logged in as bpepers and just do "createdb foo" on the
> command line. I get this error message:
> createdb: could not connect to database postgres: FATAL: Ident
> authentication failed for user "bpepers"
> Anyone know why this is happening?

You need to "createuser" first.  Add a "bpepers" user to PostgreSQL with 
the right to create new databases.  Afterward, you'll be able to 
"createdb" as the system user "bpepers".

As root:
su postgres -c "createuser bpepers"

> The pg_hba.conf is using "ident
> sameuser" for local connections. As far as I know this should allow the
> postgresql server to authenticate that I'm me.

It does.  The server knows your system user name, but does not have a 
user of its own to which you can be mapped.  As such, it does not know 
what permissions should be given to you.

> The first problem means a number of extra steps run as root
> and the second seems to mean the user will have to edit PostgreSQL
> config files in order to get things running.

No editing should be required.

More information about the fedora-list mailing list