MySQL older versions(<<5.x)
1.You will have to generate an MD5 hash of your desired password. You can generate one from here
1 |
http://www.miraclesalad.com/webtools/md5.php |
2. Get access to MySQL command prompt.
1 2 |
#mysql -u root -p Enter password: |
Enter the mysql root password.
3. Get the list of databases currently on your server.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
mysql>SHOW databases; +--------------------+ | Database | +--------------------+ | information_schema | | cphulkd | | eximstats | | foryou_wp | | horde | | leechprotect | | modsec | | mysql | | performance_schema | | roundcube | | whmxfer | +--------------------+ 11 rows in set (0.00 sec) mysql> |
4. Select your wordpress database ( here it is foryou_wp)
1 2 3 |
mysql> use foryou_wp; Database changed mysql> |
5. Find the table name with ‘users’ at the end ( here it is wp_users)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
mysql> show tables; +------------------------+ | Tables_in_foryou_wp | +------------------------+ | wp_commentmeta | | wp_comments | | wp_links | | wp_options | | wp_postmeta | | wp_posts | | wp_term_relationships | | wp_term_taxonomy | | wp_terms | | wp_usermeta | | wp_users | +------------------------+ 11 rows in set (0.00 sec) mysql> |
6. To get the details about the user, user ID etc; enter the following command.
1 2 3 4 5 6 7 8 9 |
mysql> SELECT ID, user_login, user_pass FROM wp_users; +----+------------+------------------------------------+ | ID | user_login | user_pass | +----+------------+------------------------------------+ | 1 | admin | d51b9f2635741a855162826d2e13185c | +----+------------+------------------------------------+ 1 row in set (0.00 sec) mysql> |
7. Update the new password with the following command.
1 |
UPDATE (name-of-table-you-found) SET user_pass="(MD5-string-you-made)" WHERE ID = (id#- of-account-you-are-reseting-password-for); |
Command should look like:
1 |
mysql>UPDATE wp_users SET user_pass="f367084816d16de2660a1d1493c0a62c" WHERE ID = 1; |
8. Make sure that the password has changed.
1 2 3 4 5 6 7 8 |
mysql> SELECT ID, user_login, user_pass FROM wp_users; +----+------------+------------------------------------+ | ID | user_login | user_pass | +----+------------+------------------------------------+ | 1 | admin | f367084816d16de2660a1d1493c0a62c | +----+------------+------------------------------------+ 1 row in set (0.00 sec) mysql> |
9. Quit from mysql prompt.
1 2 3 |
mysql>quit Bye root@server [~]# |
MySQL recent versions (5.x)
Skip step 1 and replace the step 7 with following.
1 |
mysql>UPDATE (name-of-table-you-found) SET user_pass = MD5('"(new-password)"') WHERE ID = (id#-of-account-you-are-reseting-password-for); |
Command should look like:
1 2 3 4 5 |
mysql> UPDATE wp_users SET user_pass = MD5 ('Qwerty123') WHERE ID = 1; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> |
That’s it!