ubuntu - How to configure postgresql so it accepts login+password auth? -


i have fresh ubuntu 10.10 install updates , postgresql 8.4
in order postgresql accept login+password connections have configured via:

sudo su postgres psql alter user postgres password 'password'; create database myapp; \q exit sudo vi /etc/postgresql/8.4/main/pg_hba.conf change "local all indent" "local all trust" 

but, surprisingly, not working! command

psql -u postgres password 

evaluates error:

psql: fatal:  ident authentication failed user "postgres" 

any hints how can make psql -u work?

it idea leave "postgres" user ident authentication. default believe ubuntu uses "postgres" user perform upgrades, backups, etc, , requires able login without specified password.

i recommend creating user (probably own username) , giving admin privileges well. can use user passwords on local connections.

here relevant parts of pg_hba.conf like:

# allow postgres user use "ident" authentication on unix sockets # (as per recent comments, omit "sameuser" if on postgres 8.4 or later) local     postgres                         ident sameuser # allow other users use "md5" authentication on unix sockets local                                  md5 # users connected via local ipv4 or ipv6 connections, require md5 host             127.0.0.1/32          md5 host             ::1/128               md5 

also note psql -u postgres password not want. password should never specified on commandline. try login user "postgres" database named "password".

you should use psql -u postgres myapp instead. postgres automatically prompt password, if configured require one.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -