How to reset password for all users in WordPress site within MYSQL databases

A typical installation of WordPress usually has MySQL database as the backend, recently I found a need to reset the password for multiple users in one go. Here is how it was achieved.

  • First install MYSQL Workbench on the required machine. MySQL Workbench can be downloaded here.
  • Identify the database and the connection string details from the wp-config.php file.
  • Connect to the database from within MYSQL Workbench as listed here.
  • Once connected look for the table wp_users in the database.

In a new query windows execute the below query to reset a single or multiple rows password as required.

UPDATE wordpress746.wp_users
SET user_pass = MD5('NewPassword')
WHERE length(user_login) = 4

e.g. in this case I reset the password for all users who have a four letter username.

And that’s it !!

Please Consider Subscribing