Reset your WordPress password via the database

Found yourself in a scenario where your trying to access a hosted WordPress site, but either can't remember or don't have access to the password and email address? This article will help you regain access to the admin area.

In this article we're going to look at how you can reset a WordPress password via the database using phpMyAdmin or command line.

Reset WordPress admin password using phpMyAdmin

If your server or cpanel has phpMyAdmin installed then this should be nice an easy. Follow the steps below to reset your one of your WordPress admin user passwords:

  • Login to phpMyAdmin (can access via cpanel if using)
  • Go to the users table (usually wp_users)
  • Go to coveloping.com and md5 your password with the hash tool
  • Copy this into the user_pass field in phpMyAdmin
  • Login with your new password!

Reset WordPress admin password using Command line

If you don't have phpMyAdmin available to you, but can

  • Go to the root of your application and edit the wp-config.php file
    nano wp-config.php
  • Find the username and password used for the mysql database, note it and exit the file.
  • Login to your server and run mysql on command line:
    mysql -p -u yourusername
  • Enter the password from the wp-config file
  • Select the correct database (replacing wordpress below with your database name as defined in wp-config)
    use wordpress;
  • To find out the exact title of the users table, type:
    show tables;
  • Identify the users table then run:
    SELECT * FROM wp_users;

    TIP: Make your console nice and wide and it will be a lot easier to read!

  • Go to coveloping.com and get a md5 hash of the password you want to use, then apply it in the below command, along with the id of the user you want to reset the password for:
    UPDATE wp_users SET user_pass = 'longmd5hash' WHERE ID = 1;

Either of the two methods above should have you back up and running with admin access to your WordPress site.

Sign Up

NEXT: WordPress shortcode menu plugin

Add a WordPress shortcode plugin to your client sites to make managing content even easier!

comments powered by Disqus
Sign Up

Popular Tags

350x250

Need a web developer?

If you'd like to work with code synthesis on your next project get in touch via the contact page.