简体   繁体   中英

PostgreSQL: Can't log into Postgres - sudo broken?

Hey so after I ran into somes issues I decided to uninstall Postgres and re-install it (re install a newer version btw).

I'm trying to access postgres to create a new db for my Rails app so I run su postgres or su _postgres then I am asked a password but nothing that I enter works.

So I tried sudo -u postgres psql and got

sudo: unknown user: postgres
sudo: unable to initialize policy plugin

I tried also to disable SIP (see: here )

but it didn't work either. same results.

I don't know what to do. Any idea ? I am using Mac OS High Sierra 10.13.6.

感谢 @gordon Davidson 和 @wildplasser 的帮助,我找到了解决方案:

sudo -u myusername psql postgres

从您的 EC2 节点发出以下命令以测试数据库是否可访问。

/opt/gitlab/embedded/bin/psql -U YourExistingUsername -d template1 -h AWS-RDS-POSTGRES-ENDPOINT

I had this same challenge when trying to access a PostgreSQL database.

When I run the command below:

sudo -u postgres psql

I get the error below:

sudo: unknown user: postgres
sudo: unable to initialize policy plugin

The issue was that I did not have the PostgreSQL database server installed on the server. The server only had a MySQL database server set up on it.

That's all.

I hope this helps

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