Change Wordpress Password using MySQL

If the Forgot password option doesn’t work for you (which it really should), then you can change the password of your self-hosted Wordpress login.

Check the contents of wp-config.php for the database login. Use that login information for MySQL login.

define(‘DB_NAME’, ‘wpdatabase’); define(‘DB_USER’, ‘wpdbuser’); define(‘DB_PASSWORD’, ‘wpdbpassword’);

Replacing DB_USER and DB_NAME from that command with the values from wp-config.php, enter the following command to connect to the database on your server.

mysql -uDB_USER -p DB_NAME

Get a list of users in the Wordpress database.

select user_login from wp_users;

This might return multiple entries, but it was just one in my case: admin
To change the password, issue the following. Be sure to change ‘admin’ to the value of your user_login.

update wp_users set user_pass=md5(‘NEW_PASSWORD_HERE’) where user_login=‘admin’;

All done. Now you can log into your Wordpress administration panel with the new password you specified.

Published At
Tagged with