开发者

postgresql on macports not working. idk password

I installed postgesql from mac ports with the intention of running it on a django framework. Here are the commands that I used:

sudo port install postgresql84-server
sudo port install py26-psycopg2

After the installation I would like to now try to test a database by 1. forming it and 2. accessing it. The fir开发者_JS百科st problem I have is when I try to get into psql I have to enter a password that I dont know. Do you know where I can find this password?


PostgreSQL role's password (probably unset/empty at beginning) is completely different thing than Mac OS user's password. It should be possible to authenticate with ident method as postgres Mac user using psql command (psql -U postgres postgres is implicit). After that you can set postgres role's password.

$ whoami
postgres
$ psql
psql (8.4.8)
Type "help" for help.

postgres=# SHOW password_encryption; -- making sure that password will be MD5 encrypted
 password_encryption 
---------------------
 on
(1 row)
postgres=# ALTER ROLE postgres PASSWORD 'yourSecretPassword';
postgres=# SELECT rolpassword FROM pg_authid WHERE rolname LIKE 'postgres';
             rolpassword             
-------------------------------------
 md5738d021d4bc194576641fa9936656836
(1 row)

If this is not possible, then add following line as first rule in your pg_hba.conf (don't forget to reload/restart your server/cluster):

local   all         postgres                          ident


By default, postgres is configured with ident sameuser authentication; That means you must actually be the postgres user to connect to the database or create new roles. become that user with su - postgres.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜