How to Reset Odoo Superuser / Admin Password from Database if you have forgotten the password?

How to Reset Odoo Superuser / Admin Password from Database if you have forgotten the password?

It gets very tedious and frustrating sometimes when we cannot recall our Odoo superuser password and are not able to retrieve it by any means. Well, don’t worry now here is the solution to the problem. We can reset the password in the database. Following is how to do this:

Odoo 8.0

~$ sudo su postgres
~$ psql
postgres=# \c Your_Database_Name
You are now connected to database “Your_database_Name” as user “postgres”
Your_Database_Name=# update res_users set password=’YourNewPassword’ where id=’1′;

Odoo 9.0 and 10.0

~$ python
>>> from passlib.context import CryptContext
>>> print CryptContext([‘pbkdf2_sha512’]).encrypt(‘YourNewPassword’)
Copy the Hash created
Ctrl+D
~$ sudo su postgres
~$ psql
postgres=# \c Your_Database_Name
You are now connected to database “Your_database_Name” as user “postgres”
Your_Database_Name=# UPDATE res_users SET password=”, password_crypt=’YourCopiedHash’ WHERE id=1; Your_Database_Name=# \q

Odoo11

~$ python3
>>> from passlib.context import CryptContext
>>> setpw = CryptContext(schemes=[‘pbkdf2_sha512’])
>>> setpw.encrypt(‘YourNewPassword’)
Copy the Hash created
Ctrl D
~$ sudo su postgres
~$ psql
postgres=# \c Your_Database_Name
You are now connected to database “Your_database_Name” as user “postgres”
Your_Database_Name=# UPDATE res_users SET password=”, password_crypt=’YourCopiedHash’ WHERE id=1;
Your_Database_Name=# \q

Odoo 12 and 13

~$ python3
>>> from passlib.context import CryptContext
>>> setpw = CryptContext(schemes=[‘pbkdf2_sha512’])
>>> setpw.encrypt(‘YourNewPassword’)
Copy the Hash created
Ctrl D
~$ sudo su postgres
~$ psql
postgres=# \c Your_Database_Name
You are now connected to database “Your_database_Name” as user “postgres”
Your_Database_Name=# UPDATE res_users SET password=’YourCopiedHash’ WHERE id=2;
Your_Database_Name=# \q

I hope this helps everyone. If you find any issues or errors or have any suggestions, feel free to comment, and I will be more than happy to update the content.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: