Rajeeb binRazaq
Rajeeb binRazaq

Reputation: 31

How to change the postgres database user role password from 'admin' to 'mypassword'?

I was trying to change PostgreSQL database user role password from 'admin' to 'mypassword' in odoo-10. I've tried ALTER ROLE "odoo" WITH PASSWORD 'mypassword'; in postgres and restarted postgresql service.

But it is not working. When i start odoo server again it shows error like FATAL: password authentication failed for user "odoo" and It is working fine if I change this password back to 'admin'. I've tried of making corresponding changes in both "/etc/odoo.cof" and "/odoo/tools/config.py" and it does'nt solve my issue too.

Is there anything else that i missed to try ? Hope you'll help me to fix this issue.

Thanks in advance!!

Upvotes: 1

Views: 15643

Answers (2)

mohd4482
mohd4482

Reputation: 1918

Try this single line:

sudo -u postgres psql -c "ALTER USER <user> WITH ENCRYPTED PASSWORD '<password>';"

replace <user> and <password> with corresponding data.

Upvotes: 3

Nikesh Chaudhary
Nikesh Chaudhary

Reputation: 69

Try this:

$sudo -u postgres psql database_name

$ALTER USER postgres with encrypted password 'ur password';

Upvotes: 6

Related Questions