If you’ve forgotten your WordPress password and have access to your MySQL database, changing your password is a piece of cake.
From your server, these commands will get you into your wordpress database:
# mysql -p
# *password*
mysql> connect wordpress;
mysql> select * from wp_users;
mysql> UPDATE wp_users SET user_pass=md5(‘NEWPASSWORD’) WHERE user_login=’USERNAME’;
The select statement just lets you peek at the contents. Hopefully you already know your wordpress admin username. Also, if your database isn’t named “wordpress” you should be able to look it up. My database names and schemas are located at /var/lib/mysql
The only problem that might arise is if you don’t know your mysql user/pass combination. Fear not! To reset your mysql root password is fairly simple:
1. Find the mysql daemon
ps -ef | grep mysql
2. Kill the daemon!
kill -9 ‘pid’ (the process id)
or
pkill mysqld
3. Run MySQL in “safe mode” and skip grant tables. This lets you login as root with no password, essentially.
mysqld_safe – – skip-grant-tables &
mysql -u root mysql
4. Reset the password!
UPDATE user SET password=PASSWORD(“NEWPASSWORD”) WHERE user=”root”;
FLUSH PRIVILEGES;
That’s it. Now your password is reset and you will be able to login. The only thing left is to stop the safe daemon from running and start the actual mysql process.
Stopping the mysql safe daemon:
pkill or kill -9 the “mysqld_safe” process
Starting mysql:
service mysql start
OR
find it in your /etc/ folder, ie. /etc/init.d/mysql , /etc/rc.d/mysql , etc…