Reputation: 139
I am trying to set new password in postgreSQL.But I am getting error like below.
[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`
Upvotes: 2
Views: 5319
Reputation: 1677
Highly recommended to avoid ever using the ALTER USER Postgres WITH PASSWORD...
syntax as there is a possibility whatever password you submit will be saved forever in your on disk logs.
Whenever possible, the best way to do it is through an interactive psql CL like so:
psql=# \password user_name
If you cannot do that, consider using SCRAM-SHA-256 authentication and the method described here.
Upvotes: 0
Reputation: 139
This works for me.
ALTER USER postgres WITH ENCRYPTED PASSWORD 'password';
Upvotes: 1
Reputation: 349
Try this? Link
Login to your database and use the ALTER USER Postgres WITH PASSWORD '<newpassword>';
command.
Upvotes: 0