reset wordpress admin password using MySQL

If you wish to reset the password from cli, using MySQL prompt, use the following commands:

Login to server via ssh and go to MySQL prompt by entering the following in the cli.


Use the corresponding database for the wordpress install. You can locate it from the wp-config.php file.

$use wordpress_dbname;

Check for table wp_users table.

$show tables;

Use the following to find the details of the table.

$SELECT ID, user_login, user_pass FROM (table_name);

Now update the password using the following command.

$UPDATE (name-of-table) SET user_pass=”(MD5-string_of_password)” WHERE ID = (accocunt_id_number);

For the latest MySQL versions, you can generate the MD5 using the MySQL.

$UPDATE `wp_users` SET `user_pass` = MD5(‘new_password’) WHERE `wp_users`.`user_login` = “admin_username”;