Placeholder canvas

How To Reset The Password For WordPress By MySQL in 2024

At times, a WordPress user possessing capabilities like administrator, editor, author, contributor, or subscriber may overlook their login credentials, particularly the password.

While the WordPress password can be conveniently reset through the “Lost Password” form on the WordPress login page, complications arise when the user lacks access to their email address. 


Under such circumstances, the task of updating a WordPress account password becomes feasible only for a system administrator with complete privileges over the MySQL database daemon.

This tutorial will guide you through the process of resetting a WordPress account password using the MySQL command line in a Linux environment.


To reset your password using MySQL CMD, you can follow these simple steps. It’s a handy method that works in many situations.

However, you should know a bit about databases and how to work with them. Also, make sure you have the following technical details:

1. The name of the database your WordPress site uses.

2. The address of your MySQL server (it can be an IP or a hostname).

3. Use “root” as the user for MySQL.

4. Know the User ID and password you want to change. 

Typically, the User ID is 1, as the admin user is usually created first during WordPress installation. Keep in mind that the administrator’s username can be anything; it’s the User ID that’s usually 1 because it’s the first user created.

How To Create A Temporary Login WordPress in 2023: How To Reset The Password For WordPress By MySQL in 2024

Access MySQL using the Windows command line

To access the MySQL command line on Windows, follow these steps if you have a local WordPress installation through WAMP or XAMPP:

1. Find the WAMP icon and click on it.

2. From the menu, select MySQL, and then choose MySQL Console.

After this, you won’t need to input any additional commands here. Proceed to the following stage of the procedure.

MySQL console

Access MySQL using the Linux command line

To log in to the MySQL command line on Linux, follow these steps, depending on your setup:

1. Local WordPress on Linux (LAMP):

If you have a local WordPress site on Linux through LAMP, open the terminal emulator and type:

mysql -u root -p

2. Remote Server via SSH:

If your WordPress site is on a remote server, connect to the server using SSH, for example, with a tool like Putty. After logging in to the remote server, access My-SQL with the following command:

mysql -u root -p <password>

Replace `<password>` with the actual password. These commands allow you to log in to the My-SQL command line interface for both local and remote setups.

Ubuntu server MYSQl

Reset WordPress Password

It is now time to work voodoo with My-SQL CMD, which is accessible by typing the console “mysql>.” Well, it’s not magic; it’s just standard My-SQL instructions.

MySQL command line

Now that you have access to the My-SQL command line, indicated by the ‘mysql> ‘ console, it’s time to perform some My-SQL commands to reset the password. Here’s what you need to do:


  • WordPress database name: wp_genesis
  • User ID: 1
  • New password: WPEXPLORER

Follow these commands:

  1. Switch to the WordPress database:

use wp_genesis;

  1. Retrieve the current user details:

SELECT ID, user_login, user_pass FROM wp_users;

  1. Update the user password (replace the existing password with the MD5 hash of the new password ‘WPEXPLORER’):

UPDATE wp_users SET user_pass = MD5(‘WPEXPLORER’);

If the last command encounters issues, try removing the single quotation marks around ‘WPEXPLORER’ and manually enter them. This adjustment should resolve any problems.

MySQL command prompt

This process resets the user password to ‘WPEXPLORER,’ and the admin makes this change. Remember, when you set a new password, it’s a good idea to use a stronger, more complicated one.

After you’ve completed this, you can leave MySQL CMD by typing:


Final Say

While phpMyAdmin offers an easier route for password recovery and is widely supported by hosting companies, delving into My-SQL commands can be a valuable learning experience. Even though it might take a bit more time, the knowledge gained in using My-SQL commands and understanding databases can prove beneficial in unforeseen circumstances. Consider it a skill-building opportunity that could come in handy down the road.

FAQs on Password Reset for MySQL

Is it safe to reset the WordPress password using MySQL?

Yes, when done correctly. Ensure you have a backup of your database before making changes, and follow the steps precisely.

Can I reset any user’s password using this method?

Absolutely, as long as you have the necessary database access, you can reset the password for any user on your WordPress site.

Are there alternative methods to reset WordPress passwords?

Certainly, WordPress provides built-in methods, such as the “Lost your password?” link on the login page. However, the My-SQL method is particularly valuable when these options fall short.

Want faster WordPress?

WordPress Speed Optimization

Try our AWS powered WordPress hosting for free and see the difference for yourself.

No Credit Card Required.

Whitelabel Web Hosting Portal Demo

Launching WordPress on AWS takes just one minute with Nestify.

Launching WooCommerce on AWS takes just one minute with Nestify.