- 1. How To Reset Your WordPress Password Using phpMyAdmin
- 2. Currently Reading: How to Reset WordPress Password Using MySQL Command Prompt
Our WordPress Password Recovery series is sorted according to the popularity of the tutorial mentioned. For starters, you have have the most popular recovery option – i.e. using phpMyAdmin.
There are certain web hosting providers who do not provide cPanel and/or phpMyAdmin. What do you do then? Read this article!
Rest assured, since WordPress used one database – (commonly MySQL), every hosting provider must have a Database Management System better known as DBMS. In this tutorial, we’ll be using the MySQL command prompt (abbreviated as CMD) which is a free DBMS as licensed under GNU General Public License v2.
Recovering your password using the MySQL CMD involves lesser number of steps and can be thought of as an universal password recovery system; in the sense that it can be used in almost any plausible scenario.
However, you need to have a working understanding of databases and how WordPress interacts with one. Apart from that, you also need to know the following technical aspects:
- Name of the database being used by the WordPress installation
- MySQL server address (IP or hostname)
- MySQL login credentials of the ‘root’ user
- The user ID of the user whose associated password you want to change. This is typically 1 since, during WordPress installation, we create the admin user. Note that the username of the admin user can be ‘Jack’ or ‘Mike’ or ‘admin’, but the user ID will always be 1, since, this is the first user you’re creating.
Logging in to the MySQL Command Prompt
If you’re running an offline installation of WordPress in Windows using WAMP or XAMPP, then to launch the MySQL CMD, click on the WAMP icon > MySQL > MySQL console. This directly logs you in. There’s no need to enter any more commands. Head over to the next step.
Most shared hosting providers, VPS, dedicated servers use a variant of Linux which include CentOS, Debian, Fedora or Ubuntu to name a few.
If you are running an offline installation of WordPress in Linux using LAMP, then simply launch terminal emulator and type the command:
mysql -u root -pIf you’re trying to reset the password in a remote server, connect to it via SSH using any SSH client – for example, the world’s favorite client – Putty. Once you have logged in to the remote server, to login to MySQL, use the following command:
mysql -u root -p <password>
Resetting the WordPress Password:
Now that you have access to the MySQL CMD indicated by the “mysql >” prompt, its time to work the magic. Well, not magic – just good ol’ MySQL commands. 😀
- WordPress database name: wp_genesis
- User ID: 1
- New password: WPEXPLORER
WORKING THE MAGIC:
Enter the following commands ditto:
SELECT ID, user_login, user_pass FROM wp_users;
UPDATE wp_users SET user_pass = MD5(‘WPEXPLORER’) WHERE ID=1 LIMIT 1;
In case the last command does not go according to the screenshot, delete the the single quotes and manually type them in the CMD. That should do the trick.
This will reset the password of the admin user to WPEXPLORER. Of course, while setting a new password, you’ll have to use a stronger one. Once done, you can exit the MySQL CMD by using the command:
Here’s a video tutorial describing the entire process. I would recommend reading the article first, but if you’re looking for a quick fix, this is your queue:[youtube http://www.youtube.com/watch?v=ajE2ReD2qmc]
In conclusion to our WordPress Password Recovery series I’d like to remind you that part (a) is simpler because 90% of the hosting companies come with phpMyAdmin. But if you have some free time, I’d recommend trying out this part (using MySQL) as it’ll give you some experience in handling MySQL commands and databases. And who knows – maybe it’ll be of some use in the future!
Prevention is better than The cure
I started this series off by saying how password saving/backup services like LastPass thrive. Don’t get me wrong – it wasn’t my intention to come across as demeaning. I actually love and use LastPass everyday. I have it installed in my phone and in every browser in all my computers. Life (for me) would come to a stand-still without it. Honestly, I can’t survive without it.
LastPass, as it is one of the most complete and user-friendly password management software out there. I would highly recommend using it. And every time you login to a new website, make sure you actually save the password! 😉