Lost username and passwords leading to a total lockout to your WordPress site can be a potential disaster. This can typically happen when the eMail account used to recover a password is no longer accessible. Fortunately, there is another trick to get in using a ‘backdoor’ approach through the MySQL database.
To gain access to the WordPress database, you will need to have the login and password for the database and use of a database query tool. For MySQL, most hosts provide the phpMyAdmin tool from the host dashboard or cPanel. Further, the web host might also have automatic login to the tool, eliminating the need to have the username or password to the database.
If you do not know the username and password to the database, there is one last place you can recover it. The WordPress config.php file contains this information. Look for the following lines in the file:
define( ‘DB_USER’, ‘MyUserName‘ ); // Example MySQL username
define( ‘DB_PASSWORD’, ‘MyPassWord‘ ); // Example MySQL password
Note: MyUserName and MyPassWord will be the information you need to login to the database throught phpMyAdmin.
For the next steps, you will add a new username and password with administration privileges by directly adding the information to the database. The web site wpbeginner.com has an excellent step-by-step article, How to Add an Admin User to the WordPress Database via MySQL, that will guide you through this process
Note: The article has one error. The meta-key field for wp_capabilities should have the value –
a:1:{s:13:”administrator”;b:1;}
Once the new username and password has been entered into the database, you can now login through the WordPress login page, and operate as a WordPress admin.
Possible Issues: Visual editor tabs not showing in edit mode on page or post.
Solution: Clear the cache. If that doesn’t work, go to the user profile, check the Visual Editor option. Update. Then uncheck it, update.