在PostgreSQL中设置密码

时间:2016-02-26 07:43:21

标签: psql

我正在尝试在postgreSQL中设置新密码。但是我收到如下错误。 [root@localhost ~]# sudo -u postgres psql

 could not change directory to "/root"
 Welcome to psql 8.1.23, the PostgreSQL interactive terminal.
  Type:  \copyright for distribution terms
    \h for help with SQL commands
    \? for help with psql commands
    \g or terminate with semicolon to execute query
    \q to quit`postgres=# \password postgres
  Query buffer is empty.
  \p: extra argument "assword" ignored
  \p: extra argument "postgres" ignored`

2 个答案:

答案 0 :(得分:0)

试试这个? Link
登录到您的数据库并使用ALTER USER Postgres WITH PASSWORD '<newpassword>';命令。

答案 1 :(得分:0)

这适合我。 ALTER USER postgres WITH ENCRYPTED PASSWORD 'password';