Update users' password from the database directly

Hello,
I want to update passwords for some users using mysql (terminal) not GUI, which should be faster.
But I couldn’t find which table that contains that users’ passwords
I searched in tabUser table but it doesn’t have a column like this.

where can I find it and is it possible to change password in this way?

Hi @Mohsin1990,

I did this a few years ago; here’s some notes I took that might help you:

  • The User passwords are saved in a special table named ‘__Auth
SELECT doctype, `name`, fieldname, `password`, encrypted
FROM `__Auth`
WHERE doctype = 'User'
AND fieldname = 'password'

The passwords are hashed. So, to update via SQL alone? You must first (outside of SQL), determine the hashed value for each plain-text password.

To see how this is accomplished with the Frappe framework, examine the file ../apps/frappe/frappe/utils/password.py

Here’s a link with more information about the passlib library:
https://passlib.readthedocs.io/en/stable/faq.html

4 Likes

Thank you @brian_pond that was helpful. but since I can’t update directly from SQL and it requires Hash, it will take long time to solve.
I found another solution that I can export the list of users as an Excel sheet then update the “Set New Password” column to the new password then import it to the system. Here I can change the password for all users at once.

1 Like