I recently got asked to look at friends WordPress site. Nothing major just installing a few plugins and changing around the permalinks. However there was big problem it’s been a over year since she’s last logged into the site and she doesn’t know her password. The password reset email also doesn’t seem to be sending out. So I’m going to lists some methods how to get into one of your WordPress site if you locked out.
There are two ways that I know of which can create a new user the first method you would need SSH access and WP CLI installed on the WordPress site. If you don’t know about WP-Cli I wrote post about it called My most used WP-CLI commands. Which give instructions how to install it. The other method is you going to need Mysql user to the site.
This is the method I went through to get access to the site. As mentioned earlier when using WP CLI it’s important that you have ssh access and WP CLI installed. The first thing to do is go to the route folder open the command line terminal and enter the following command.
wp user create USERNAME EMAIL --role=administrator --user_pass=PASSWORD
If you replace USERNAME, EMAIL and PASSWORD with your credentials. Now log into the site and you should now be in as a administrator. More information on the WP user create docs.
For this method you going to need a MySQL user for the site. If you have a PHPMyAdmin user you should be to go. WPEngine has a good post how to to do this called Add admin user with phpMyAdmin.
Both these methods above shows you how to get access to one of your WordPress site if you don’t have a user or been locked out.