If you forget the login to the WordPress dashboard and the “forgot your password” link isn’t working for you, it is possible to change it from the command line. First, you will want to find the database that WordPress is using, so go to the folder that holds it, and get that from the wp-config.php file.
#]grep -i db wp-config.php
That will show you the database information from that file. It will come out like this. All that you will need for what we are doing is the database name, which is db_name.
[email protected] [/home/user/public_html]# grep -i db wp-config.php
Then, you will need to drop into the mysql command line using that database.
After that, you will want to list the users that are in the database to get some of the information that you will need to change the password.
mysql>select * from wp_users;
That will show the users and the ids for the users, which will look something like this.
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
| 1 | Admin | dOInlojhdE93LpD/kdiascxpItw33Ld/ | admin | [email protected] | | 2011-01-06 08:08:52 | | 0 | Admin |
| 2 | user2 | dOInlojhdE93LpD/kdiascxpItw33Ld/ | user2 | [email protected] | http://www.yoursite.com | 2011-01-11 22:27:31 | | 0 | User2 |
2 rows in set (0.00 sec)
Finally, it’s time to change the password. You will use the id number in the first column of the user you need to change in this command. If we are changing the user admin with the id number 1, we would use this.
mysql> update wp_users set user_pass = MD5('password') where ID = 1;
Now, you should be able to log into the dashboard with the username and whatever you put in the place of password.