1. Home
  2. CMS/Applications
  3. How to Change the WordPress Admin Login Password

How to Change the WordPress Admin Login Password

It can happen that you forget your WordPress administration login password.

If this ever happens to you, here is a step-by-step guide on how to change your password. You can do it from your database or from the command line.

This article uses the MD5 hashing technique. New WordPress installations use a more secure password hashing algorithm than MD5. We strongly recommend that you change your password again from your WP dashboard as soon as you log in to ensure that you are using the latest password hashing technique.

Please note that direct modification of your WordPress database should be carried out with caution. Be sure to backup your database (how) before making any changes.

Note : The Glossary contains explanations on multiple topics and can be consulted to clarify certain terms.

Change Password From Database

To change the password with phpMyAdmin:

  1. Open phpMyAdmin (how).
  2. Select the database associated with your WordPress:
  1. Click on the wp_users table (the prefix may be different from wp, depending on how your WordPress has been configured):
  1. Locate your administrator username, and click on the Edit button next to it:
  1. Set the new password. To do so, proceed as follows:
  • locate the user_pass field;
  • choose MD5 from the drop-down list under the Function column;
  • enter your new password in the text field under the Value column; and
  • click on the Go button at the bottom of the window.

Note : Since MD5 is a type of encryption, it is normal for the password not to appear as you entered it.

Changing the Password From the Command Line in MySQL

To access your WordPress database via the MySQL command line, you need to know your database credentials. These credentials are usually stored in the wp-config.php file, which is located in the root directory of your WordPress installation.

Here are the steps to follow:

  1. Connect to your server via SSH (how) and enter the MySQL command line using your database credentials.
  2. Use the following command, replacing user with your user, then enter your main account password when prompted:
mysql -u user -p
  1. Select your WordPress database by executing the following command line query (replace wordpress_db with the name of your database):
USE wordpress_db;
  1. Make a SELECT to be sure to modify the right row:
SELECT * FROM wp_users WHERE user_login = 'user';
  1. Run the following query to change your password (replace new_password with the desired password, and user with your administrator username):
UPDATE wp_users SET user_pass = MD5('new_password') WHERE user_login = 'user';
Updated on August 21, 2024

Related Articles