Scotts Web Dev Banner
Did you notice... every article on this site has an associated video? Consider subscribing to Scotts Web Dev on YouTube! :)

How to reset WordPress Password through PHPMyAdmin or MySQL CLI

This video shows you two ways to reset your WordPress password if you’ve been locked out of your account.

*Always take (or have) a database backup before doing any database operations.*

Step 1:
Locate and find your wp-config.php file for your WordPress installation. This can be locally or on your server (through File Manager or FTP (see how to use ftp)). Open it up and view the contents.

Note the database name, database user, database password, and wp_prefix. This information will be used in later steps.

Method 1: PHPMyAdmin

  • Log into phpmyadmin and find the database table from wp-config.php and click on that database name on the left side.
  • Find the wp_users (or similar) table and click on it.
  • Edit the row for the user you want to change the password.
  • Next to user_pass field, select md5 in the dropdown and erase the contents on the right of the dropdown. Type your new password here.
  • Hit go.
  • Your password has been changed and you can now log in.

Method 2: MySQL CLI

  • SSH into your server or open a terminal if your WordPress installation is local. (see how to SSH on windows)
  • Type “mysql -u yourusername -p” (without the quotes, replacing yourusername with your actual database user from wp-config.php). Hit enter.
  • Type “USE databasename;” (without the quotes, replacing database name with the name of your database from wp-config.php)
  • If it says “database changed”, proceed. If it does not, find the correct name of your database and try again.
  • Once in the database, type the following query without the double quotes into your terminal:
UPDATE wp_users SET user_pass = MD5('yournewpassword') WHERE user_login = 'youraccountlogin';

(wp_users may be different, depending on the $wp_prefix value from wp-config.php. Replace yournewpassword here with your actual new password, keeping the single quotes in place. youraccountlogin should be replaced with the username you’re using to log into wordpress with.)

You can also do it by email address if you only remember your login email. That query would look like this:

UPDATE wp_users SET user_pass = MD5('yournewpassword') WHERE user_email = 'your@emailaddress.com';

(replace your@emailaddress.com with your actual email address, keeping the single quotes)

Don’t forget the ending semi colon. If you do forget it, mysql will present you with a new prompt where you can just type “;” without the quotes and hit enter.

If you liked this video, please like and subscribe to my youtube channel.

Hope this helps! Leave me any questions or comments below.