Reset Password of wordpress admin in Cpanel

Sometimes we forget our wordpress admin details and unable to login to wordpress admin page. So we need to change the wordpress admin password. We have to change the entries of the database of our blog.

First of all we need to find the database name from wp-config.php file which is resided under the document root of our blog. Let us see an example:

Enter into the document root:

# cd /home/<User>/public_html/

Read the wp-config.php file to find the database name.

grep DB_NAME wp-config.php

define(‘DB_NAME’, ‘manuuusc_wrdp1‘);

Here manuuusc_wrdp1 is my database.

Enter into the database:

# mysql -u root -p

mysql> use manuuusc_wrdp1;

 

Reset Password of wordpress admin

wp_users is the table which stores the wordpress admin username and password. Here we are going to list the username and password of wordpress admin

mysql> SELECT ID, user_login, user_pass FROM wp_users;

+—-+————+————————————+

| ID | user_login | user_pass                          |

+—-+————+————————————+

|  1 | manuuus | $P$Bk.5oPHM7GF4oXzU5KCtGjXZ3.kYfm/ |

|  2 | Manu…    | $P$B8p0Vj00rNyuxHRJ4uDr5L0mHzvI0G/ |

+—-+————+————————————+

2 rows in set (0.00 sec)

Here manuuus is the username of the wordpress admin. We can see the encrypted password of that user. If we forget the password, we need to change that entry with the new password. We have to use encrypted code of the password which we want to set. We can encrypt our password from http://www.iwebtool.com/md5

Use the new encrypted code in this query to update the password:

mysql> UPDATE wp_users SET user_pass=”ad3165a73bf81562684b6e88983bb650” WHERE ID = 1;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

 

 

mysql> SELECT ID, user_login, user_pass FROM wp_users;

+—-+————+————————————+

| ID | user_login | user_pass |

+—-+————+————————————+

| 1 | manuuus | ad3165a73bf81562684b6e88983bb650 |

| 2 | Manu… | $P$B8p0Vj00rNyuxHRJ4uDr5L0mHzvI0G/ |

+—-+————+————————————+

2 rows in set (0.00 sec)

 

New password has been updated.

 

To reset the username of wordpress admin

List the user’s:

 

mysql> SELECT ID, user_login, user_pass FROM wp_users;

+—-+————+————————————+

| ID | user_login | user_pass |

+—-+————+————————————+

1 | manuuus | ad3165a73bf81562684b6e88983bb650 |

| 2 | Manu… | $P$B8p0Vj00rNyuxHRJ4uDr5L0mHzvI0G/ |

+—-+————+————————————+

2 rows in set (0.00 sec)

 

Here we are going to change the user manuuus to manu

 

mysql> UPDATE wp_users SET user_login=”manu” where ID = 1;

Query OK, 1 row affected (1.60 sec)

Rows matched: 1 Changed: 1 Warnings: 0

Username has been updated

 

 

mysql> SELECT ID, user_login, user_pass FROM wp_users;

+—-+————+————————————+

| ID | user_login | user_pass |

+—-+————+————————————+

| 1 | manu | ad3165a73bf81562684b6e88983bb650 |

| 2 | Manu… | $P$B8p0Vj00rNyuxHRJ4uDr5L0mHzvI0G/ |

+—-+————+————————————+

2 rows in set (0.00 sec)

About mcsaormoney