Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to Reset the Odoo Admin User Password: A Summary for different Odoo Versions

Subscribe

Get notified when there's activity on this post

This question has been flagged
passworduserresetadmin
6 Replies
123738 Views
Avatar
Ermin Trevisan

How do I reset the password of the admin user of my Odoo database? This is not the Odoo instance admin password (sometimes called "master password"), which is defined in the odoo.conf file.

10
Avatar
Discard
Herve

great, thanks !

nickchacha@gmail.com

Worked like a cham. 

Thanks a lot for the post

Abdelkarim Mateos

A lot of thanks for you post.

I'm using Odoo 11 and work perfectly.


I can't upvote for ¢#@$&$@ karma system.


Best regards


Avatar
Ermin Trevisan
Author Best Answer
Preliminary Remark: When you have migrated your database from an earlier version, the ID of your admin user may be different than suggested below. In this case you should check the ID of your admin user directly in the res_users table in your database.


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
Ctrl D
~$ 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')
Copy the Hash created
Ctrl D
~$ 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'])
>>> setpw.encrypt('YourNewPassword')
Copy the Hash created
Ctrl D
~$ 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!

37
Avatar
Discard
Juan Formoso Vasco

Great answer, thanks!

Ermin Trevisan
Author

@Lima: for me and many others it does work. So you may want to be more specific.

Jaime Pedraza

smoooooth!!

Mohamed Seddik El Behi

and what about odoo14???

zhanghao章浩

try it on Odoo13,

select password from res_users where id=2; it's changed, but still can't login ....

zhanghao章浩

and i use select * from res_users where id=2; between two database ,

found can't login reason is active ='f';

UPDATE res_users SET active='t'; now it's ok ,thanks

Ayodeji Bello

What a great summary! Thank you.

Avatar
Levenez Morgan
Best Answer

If you want reset password to 1 


sudo -u postgres psql

\connect YOUR_DATABASE

UPDATE res_users SET password='$pbkdf2-sha512$25000$4xwjZEwJgbCWsvaec875nw$eKhXFLBpAWHixi3QaE4/UHVfDLKEFLV5ZG4HFWP2FfctTAi6Jx4pahTQWgnVbqO3yXl9AQgdM8gHksNrbrh8Jg' WHERE id=2;

1
Avatar
Discard
Avatar
Maaldhowr Solutions
Best Answer

Here is the best and shortcut way to get the password:

in the terminal:

type: 

1.sudo su postgres

2.psql 

you get like this:postgres=#

3. \connect your_db_name

you get this message:

You are now connected to database "your_db_name" as user "postgres".

4. type UPDATE res_users SET password='new_password' WHERE login = 'your_email';

Now you are set and good to go.

If you don't know your_email login, do the follwinng:

in step 4, just write the following:

your_db_name=# select id, login from res_users;

and you get:

id             login

----------------

1              publice

2              etc




1
Avatar
Discard
Avatar
Riccardo Zorn
Best Answer

Update december 2024.

If you try to run the python code it will throw with current versions of passlib.

Create a virtual environment, activate it and install passlib:

$ python -m venv .venv
$ . .venv/bin/activate # or something similar on windows
(.venv) $ pip install passlib

then in python3 run:

$ python3
from passlib.hash import pbkdf2_sha512
print(pbkdf2_sha512.hash('YourNewStrongPassword'))

Tested with Odoo 16 still works like a charm

0
Avatar
Discard
Avatar
Osiris Rodríguez
Best Answer

In my case i made all the steps from Ermin, but still not working, to solve the problem i have to reset to null some fields in res_users table in the postgres database. sale_team_id and website_id have to be in null in order to gain access and login. And also be aware than the partner_id point directly to the correct res_partner table field id.

0
Avatar
Discard
Avatar
Dominique Chabord
Best Answer

hi, thank you. How different are Odoo 9-10 and Odoo 11 ? Why do you specify two different syntaxes ?


Edit after your comments:

It seems to me the syntax may depend on python2 vs python3, independently from Odoo version.

I run Odoo 11 on python3 of course, but my script which changes the password uses python2 according to first syntax and no bug was reported up to now.

0
Avatar
Discard
Ermin Trevisan
Author

I have just found out when I wanted to use the same syntax as for Odoo 9-10, that this did not work anymore for Odoo 11. After a lot of googling and trial and error, the syntax I have described did work. I was reading the available doc about CryptContext again and again, but I do not understand, why the first syntax ever worked, nor why this syntax did not work anymore nor why the new syntax works, that I have described. But I'm not a developer anyway...I'm just glad I was able to reset the password ;-)

Ermin Trevisan
Author

Example: from my understanding of the doc for passlib 1.7.0 I understood that it should be "setpw.hash('YourNewPassword'), but it did not work, and "setpw.encrypt" was just the result of trial and error.

Ermin Trevisan
Author

@Dominique: Yes, I'm aware that is depending on the Python version, but I wanted to make it easily understandable without knowing which Python version is used in which Odoo version. On my Ubuntu 16.04 LTS server I was not able to run the commands for Python 2 as mentioned for Odoo 9&10, therefore I came up with the separate version for Odoo 11.

Ermin Trevisan
Author

However I believe it is important to know how it works with Python 3.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Admin User Missing Solved
password user admin
Avatar
Avatar
2
Sep 21
7906
Retrieve hashed password in Odoo 13 Solved
password user admin odoo13
Avatar
Avatar
Avatar
Avatar
5
Mar 21
15213
How to change or update the password of a user in odoo? Solved
password user
Avatar
Avatar
Avatar
Avatar
3
Mar 23
23556
Can't assign password to users
password user
Avatar
Avatar
Avatar
2
Mar 15
7998
Admin password reset not working, tried database, odoo.conf
password database admin
Avatar
Avatar
2
May 25
3458
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now