views:

305

answers:

4

Did a new install of postgres 8.4 on mint ubuntu. How do I create a user for postgres and login using psql?

When I type psql, it just tells me

psql: FATAL: Ident authentication failed for user "my-ubuntu-username"

+1  A: 

Try this:

sudo -u postgres createuser -s $USER

now you can do createdb mydatabase, and psql -d mydatabase

Evan Carroll
same error :-(createuser: could not connect to database postgres: FATAL: Ident authentication failed for user
try again, forgot the -u postgres
Evan Carroll
didn't give an error this time, but I am not inside psql. what am I missing?
updated again, with instructions on how to create the db and login
Evan Carroll
that worked, thank you so much
A: 

by default you would need to use the postgres user:

sudo -u postgres psql postgres
thank you. I am in, but I am not logged in as the ubuntu user(name), right?
A: 

The error your are getting is because your-ubuntu-username is not a valid Postgres user.

You need to tell psql what database username to use

psql -U postgres

You may also need to specify the database to connect to

psql -U postgres -d <dbname>
cope360
I tried "psql -U postgres", got the same error.I haven't created any database yet, just made a fresh install.
A: 

Check this blog post.

depesz