Oct 25, 2012

How to: Change WordPress Password When You Can’t Access WP-Admin..!

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 */
define('DB_NAME', 'wordpress');
phpMyAdmin List of Databases
phpMyAdmin List of Databases
  • 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.
wp_users Table and Edit Button
wp_users Table and Edit Button
  • 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.
Enter MD5 Hash and Save
Enter MD5 Hash and Save
Now you can login to your wp-admin using the username and the new password.

0 comments:

Post a Comment