Odoo 8.0:
Change the password directly in the Postgres Database, as it is saved in plain text:
~$ sudo su postgres ~$ psql postgres=# \connect Your_Database_Name You are now connected to database "Your_database_Name" as user "postgres" YOurDatabase_Name=# update res_users set password='YourNewPassword' where id='1';
Odoo 9.0 and Odoo 10.0:
Create a hash and then change the hash in the Postgres database:
~$ python >>> from passlib.context import CryptContext >>> print CryptContext(['pbkdf2_sha512']).encrypt('YourNewPassword') Copy the Hash created ~$ sudo su postgres ~$ psql postgres=# \connect Your_Database_Name You are now connected to database "Your_database_Name" as user "postgres" YOurDatabase_Name=# UPDATE res_users SET password='', password_crypt='YourCopiedHash' WHERE id=1; YOurDatabase_Name=# \q
Odoo 11:
Create a hash using Python 3 and change the hash in the Postgres database:
~$ python3 >>> from passlib.context import CryptContext >>> setpw = CryptContext(schemes=['pbkdf2_sha512']) >>> setpw.encrypt('YourNewPassword') ~$ sudo su postgres ~$ psql postgres=# \connect Your_Database_Name You are now connected to database "Your_database_Name" as user "postgres" YOurDatabase_Name=# UPDATE res_users SET password='', password_crypt='YourCopiedHash' WHERE id=1; YOurDatabase_Name=# \q
Odoo 12 and Odoo 13:
Create a hash using Python 3 and change the hash in the Postgres database:
~$ python3 >>> from passlib.context import CryptContext >>> setpw = CryptContext(schemes=['pbkdf2_sha512']) >>> hash_val = setpw.encrypt('YourNewPassword') >>> print(hash_val) >>> setpw.verify('YourNewPassword', hash_val) ~$ sudo su postgres ~$ psql postgres=# \connect Your_Database_Name You are now connected to database "Your_database_Name" as user "postgres" YOurDatabase_Name=# UPDATE res_users SET password='YourCopiedHash' WHERE id=2; YOurDatabase_Name=# \q
Please be aware that since Odoo12 the Primary Key of the admin user has changed. The new ID is 2 (not 1 as in earlier versions) in a new install, if you have migrated your database from an earlier version, it might be even a higher number – please check your res_users table in the database first in this case.
Also there is no separate field “password_crypt” anymore.
Enjoy your saved life and don’t forget to upvote this little tutorial!