Postgresql:如何设置用户的密码';博士后';当我能';你不能访问postgresql数据库吗?
我正在Ubuntu 18.04上运行postgresql 10.12 我想试用一个使用postgres的软件包。这意味着我应该弄清楚如何在postgres下设置用户、密码和数据库 Postgres正在运行,但无法登录 我很确定有一个叫“postgres”的用户 以此用户身份登录而不提供密码失败。 此外,尝试使用“postgres”或“root”密码也会失败Postgresql:如何设置用户的密码';博士后';当我能';你不能访问postgresql数据库吗?,postgresql,ubuntu,Postgresql,Ubuntu,我正在Ubuntu 18.04上运行postgresql 10.12 我想试用一个使用postgres的软件包。这意味着我应该弄清楚如何在postgres下设置用户、密码和数据库 Postgres正在运行,但无法登录 我很确定有一个叫“postgres”的用户 以此用户身份登录而不提供密码失败。 此外,尝试使用“postgres”或“root”密码也会失败 如何在无法访问数据库的情况下更改用户“postgres”的密码?这是一个新手级的修改初始密码的方法,适用于Linux Debian/Ubun
如何在无法访问数据库的情况下更改用户“postgres”的密码?这是一个新手级的修改初始密码的方法,适用于Linux Debian/Ubuntu及其衍生产品上所有新安装的
postgresql
包
postgres
(在用户shell中)sudo su-postgres
postgres
用户身份连接到postgres
数据库
(在postgres shell中)psql postgres postgres
postgres
user的密码
(在postgres psql中)更改用户postgres密码“newsecret”;
(在postgres psql中)\q
(在postgres shell中)退出
(在用户shell中)psql-h localhost postgres postgres
- 阅读并理解客户端身份验证->
- 不要将
数据库用户用于应用程序/开发,而是创建自己的用户postgres
postgres
无需密码即可登录。请参阅手册中的。