Changing WordPress Password From Database – The Magnificent Trick

Changing WordPress Password From Database – The Magnificent Trick

What happens during a WordPress Hack is that the hacker gains access to your WordPress Website. He changes the password and the email address from the Dashboard area. Because of this you completely loose the WordPress access. You can neither log in to it, nor you can use the Lost your password? link as your email address in the CMS is also changed.

You may think that it is all over but don’t get upset as there is another way to get you the WordPress access back.

WordPress Database

A database is a storage area where your WordPress user name and password is stored along with other information – like page & post titles, descriptions, meta information etc.

It is utmost important that you should also know how to resolve WordPress White Screen of death.

Whenever you log into the WordPress, then your ‘Username’ and ‘Password’ are matched to the ones stored in the database. If they match only then you are successfully logged in, if not a message Invalid Username or incorrect password is shown.

What I will do is that I will change this database password to a new one. The complete procedure of it is given below.

Locating Database Credentials In ‘wp-config.php’

You can get the database name, username, password and host information by opening the wp-config.php file. This file is kept in your WordPress website’s root folder.

Open this file in notepad and find out the following lines given below:

/** The name of the database for WordPress */
define('DB_NAME', 'i604309_wp2');

/** MySQL database username */
define('DB_USER', 'i604309_wp2');

/** MySQL database password */
define('DB_PASSWORD', 'O@xsdpTXIP)*21(~2');

/** MySQL hostname */
define('DB_HOST', 'localhost');

The above lines tells the following things about the WordPress database –

  • 1. Database name denoted by ‘DB_NAME’- ‘i604309_wp2
  • 2. Database username denoted by ‘DB_USER’ – ‘i604309_wp2’
  • 3. Database password denoted by ‘DB_PASSWORD’ – ‘O@xsdpTXIP)*21(~2’
  • 4. Database server location denoted by ‘DB_HOST’ – ‘localhost’

Change WordPress Password

Now we will show how to open the database using phpMyAdmin, and change the password.

You follow the steps outlined below.

STEP 1 – First log in to your hosting account and go to My Account.

STEP 2 – Open the cPanel by clicking the launch button.

Opening The cPanel

STEP 3 – Find phpMyAdmin in cPanel Databases section, then click it.

Opening phpMyAdmin

STEP 4 – Locating your database.

When the phpMyAdmin screen opens, on the top left section click on the first plus sign. This will open the database names, match your database name given in define(‘DB_NAME’, ‘i604309_wp2’); as explained in the previous section, and click on the plus sign before it to open.

Here, the database name is i604309_wp2 (as given in the wp-config.php file).

Locating WordPress Database

STEP 5 – You will see the database tables, click on wp_users table as it stores the WordPress username and password.

'wp_users' table stores username and password

Please note that the ‘wp_’ prefix comes from the setting $table_prefix = ‘wp_’. This setting is given inside the wp-config.php file.

STEP 6 – Changing the password.

'wp_users' table data

You will see the user list here, just click the edit link for the one whose password you want to change. You will be shown all the information in textboxes which you can change easily. The field user_pass stores the password, user_login stores the username and user_email stores the email.

Change password and email to new ones and save them by clicking the Go button on the bottom.

Editing Password and Email

Important – Please note that you have to store the MD5 value of the password in the user_pass field. You cannot store plain text.

MD5 is a very powerful encryption format which cannot be broken easily. You can get the MD5 value of the password easily from this link

After you have changed the password, you can now login to WordPress using your new password.

Thus in this way you can Reset WordPress Password and get back the access of the WordPress from the notorious hacker.


  • linkedin
  • reddit


I hope you enjoyed reading this tutorial. If it helped you then consider buying a cup of coffee for me. This will help me in writing more such good tutorials for the readers. Thank you. Buy Me A Coffee