简体   繁体   中英

sudo: unknown user: postgres

I'm currently trying to run postgresql (9.3) on my iMac but I have some issues with user postgres and psql connection.

I bought an iMac old generation (with snow Leopard) that was migrated to Lion. As followed on other StackOverflow topics I added this line on my .bash_profile :

export PATH=/Library/PostgreSQL/9.3/bin:/usr/bin:$PATH

When launching pg :

sudo su postgres -c '/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data/ -m fast start'

it returns :

su: unknown login: postgres

What should I do ?

OSX 10.8和10.9中的默认postgres用户应为_postgres ,可以使用sudo -u _postgres来运行命令

I got this same error ( su: unknown login: postgres ) when trying sudo su - postgres . I then managed to log in using sudo psql -U my.username postgres .

I could then create the appropriate users, etc.

Hope that helps.

Try to start from current user:

/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data/ -l /usr/local/var/postgres/server.log start

Additional info: How to start PostgreSQL server on Mac OS X?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM