Sometimes when you are dealing with a WordPress installation, where you can’t access the wp-admin, but have access to the cpanel, here is what you do to log In.
Think of times when another admin locks you out, changes the admin email and takes away. Or times when your client cannot remember what email she gave during sign-up and now can’t remember the password as well. Or when you are on a local host and its impossible to reset the password.
Breaking and Entering When You Get Locked Out of WP-Admin
- Login to your Host’s Cpanel (or whatever that lets you access phpMyAdmin)
- Login to phpmyadmin
- From the Left Sidebar of phpMyAdmin, choose the database of the WordPress install. You can find the name of the database from wp-config.php, look for DB_NAME and you will find something like this. In my example wordpress is the database name.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
- Now the sidebar shows a list of tables in the selected database. Find wp_users table. That brings up a list of all users in the installation.
- Passwords cannot be read off from the database, because they are encrypted or hashed. Use this tool to create the MD5 hash of a password you would like. For eg, the password “testpass” is 179ad45c6ce2cb97cf1029e212046e81
- Back in your phpMyAdmin, edit the admin, or the username that you want the password for. Change the value in user_pass to the new MD5 Hash value that you generated and save it.
Now you can login to your wp-admin using the username and the new password.
You don’t need to use an external tool to make an MD5 hash. Just select MD5 from the function dropdown of that row, enter your password and then click go. 🙂
I see, I didn’t know that. Very cool and handy. Thanks!
Great article to store in the ’emergency’ file! Bad things do happen to good people…
But will this work if your IP is blocked due to too many login attempts? e.g. the same scenario you used, another admin changes password, site has a ‘limit login attempts’ plugin and you get blocked…
You should still be able to access the cpanel, so you should be able to reset the Password. You could use a proxy to login and then whitelist your original IP 🙂
Really an useful tweak Arun. Informative. Worth Sharing 🙂
Thanks Arun for sharing these wonderful tips with us. You have simplified this process in the best and easiest way possible. I’m glad i dropped by i have learnt a thing or two that i din’t have a clue before.
Thanks Arun bro.Its really informative & helpful. 🙂
Hi Arun,Thanks for your important post.Sometimes we fall this types of situation.Mostly the clients lost password.Admins conflict is another common reason.Its really a useful post.
Awesome trick, one thing I think that I did once too was just to blank out the password, I think this makes no password, then you can just login and set it via the WordPress wp-admin like normal immediately after. This is a more secure method by far however.