Functions.php
Connect to the MySQL database:
cd /var/www/user/website
db_connect.sh
Verify the user information for the admin:
// Show user table data
SELECT * FROM wp_users;
In a new terminal tab, add a password reset script to the active theme’s functions.php file. The “1” represents the user ID number in the wp_users table in your MySQL database.
// Hasn't been working recently. Skip to the MySQL reset code.
wp_set_password( 'new_password', 1);
Refresh the home page of the website and then try to log in. If that doesn’t work, try resetting the password inside the database:
MySQL DB Reset
UPDATE wp_users SET user_pass = MD5('new_password') WHERE ID = 1;
Emergency Reset Script
Save this file under public_html or the sites main directory.
Open your browser and type in the file path to access the emergency.php file. It will look something like: http://example.com/emergency.php
A login screen should appear. You can enter your existing admin username and a new password of your choice.
Go to your WordPress login page and log in using your new credentials. An email should be sent to the administrator’s email address with the new password details. However, the password will still be changed even if you do not receive an email.
Once you’ve logged into your site using your new admin password, go back and delete the emergency.php file from your root installation. Otherwise, anyone could visit your site’s URL with the emergency.php file path and reset your admin password.
The user name field is empty.
The password field is empty.
That is not the correct administrator username.
Your password has been successfully changed
An e-mail with this information has been dispatched to the WordPress blog administrator
You should now delete this file off your server. DO NOT LEAVE IT UP FOR SOMEONE ELSE TO FIND!