Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL under Lion: What's the password?

I got my new lion machine. Ran the PostgreSQL installer from the PostgreSQL site for Mac and i have no multiple apps installed. One of them is "pgAdmin III.app". When I open it there is already one server connection available. localhost:5432

Whenever I try to connect to the server with a doubleclick the programm asks me for a password. I have no idea what to enter. It's not my admin password, it's not "postgres", it's not "localhost", it's not empty.

I just can't seem to connect to the server. Even when I check the properties of the localhost server the password field seems empty. However I'm not allowed to leave the password field empty.

Any idea what to do? I really need to setup postgres?

like image 396
matt Avatar asked Oct 13 '11 19:10

matt


3 Answers

On my Mac OSX Lion, PostgreSQL configuration files are stored under /Library/PostgreSQL/9.0/data/

like image 173
ssc Avatar answered Nov 17 '22 09:11

ssc


Haven't tried it on OSX, but on Ubuntu you can login as the system user 'postgres' to the default database 'postgres' without a password with

su postgres -c psql

You can then (re)set the password of the database superuser 'postgres'.

You can also edit the configuration file pg_hba.conf (don't know where it is located on a default OSX installation, on Ubuntu it is /etc/postgresql/8.4/main/pg_hba.conf) and grant access to the default database without authentication

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    postgres    postgres    127.0.0.1/32          trust

After editing pg_hba.conf you must reload the configuration with

pg_ctlcluster 8.4 main reload

You can then connect with pgAdmin and (re)set the password, but don't forget to change the authentication method back to md5 again...

like image 23
tscho Avatar answered Nov 17 '22 09:11

tscho


here's a better answer (works in OSX HighSierra): the account used is the one you're logged onto OSX with, therefore, the password is your password!

like image 2
ekkis Avatar answered Nov 17 '22 08:11

ekkis