Most WordPress plugins and themes will save your API key, license key, login username and password, and other details in your WordPress database. So, you will be able to easily retrieve that information from your WordPress database if you ever lose or forget them.
I had once lost the username and password that I was using in a WordPress plugin for sending emails. The username and password were from Amazon SES. And you might know that SES credentials can only be seen when they are created. So, after you create them, you will need to save the information in a different place if you intend to use them late on. But if you don’t save the information, then you won’t be able to view them again. Of course, I could create more credentials from SES if I lost the existing ones but I just wanted to use the existing one.
So, I searched on the internet for how to retrieve them from my WordPress website but I couldn’t find any relevant information. That’s why I am writing this article to help anyone facing a similar problem.
It will not only work for the login details but also any API keys or license keys that you might have lost after using them in any of your WordPress plugins or themes. It will work even if you have deactivated or deleted the original plugin or theme where you entered the details. That’s because the database entries created by the plugins and themes aren’t generally deleted when the themes or plugins themselves are deleted. That’s why you will also see that after re-activating any plugin or theme, the previous settings are still in place.
So, here is what you will need to do in order to retrieve your lost keys, username, password, or any other details from your WordPress database.
Note: This article isn’t for you if you are trying to retrieve the password that you use to login to your WordPress dashboard. But it will work if you are trying to retrieve a password that you have entered into any plugins or themes.
The first thing you need to do in order to retrieve your key or other details is to access your WordPress database. WordPress uses MySQL database management system that is administered by phpMyAdmin. So you will need to access phpMyAdmin and then choose the database that is being used by your website. You can do this in the following two ways.
Use phpMyAdmin from Your Control Panel
If you are using any web hosting control panel like cPanel, Plesk, DirectAdmin, CyberPanel or others, then you will find an option saying phpMyAdmin or database inside the control panel. Clicking on that link will take you to the phpMyAdmin URL. However, if you are hosting more than one WordPress website using one control panel, then you will see multiple databases on your phpMyAdmin navigation panel. So, you will first need to make sure which database is being used by the website in question.
Your hosting control panel may have an option in the database section that will tell you which website is using which database. You may also have your database name similar to your website name if your control panel has a setting for that or if you have renamed the database while installing WordPress. But if you couldn’t find which database belongs to which website, then you will need to confirm that after you log into phpMyAdmin.
After you find the phpMyAdmin access link on your hosting control panel and click on the link, you will be prompted to provide login details. The default login username is root but the password will vary depending on your setup and it might even be empty if it has been set like that.
Once you are logged into phpMyAdmin, you will see a list of all the databases in the navigation panel on the left-hand side. And if you want to know which database belongs to which website, then you can click on any database name to see a list of all tables inside that database. Then from the table list, click on the wp_options table. You may not see the wp_options table if that database has a lot of tables that require you to navigate to further pages to see all the tables. In that case, you can use the search box that appears just below the database name. In the search box type wp_options and press enter which will bring you the table. Now clicking on the table name will open a lot of information that is organized in rows and columns. In the first few rows, you should see your website’s URL and its name along with some other information.
This way you should be able to find the database for your website. But if you are looking for a simple solution, then you can follow the next section which will allow you to access phpMyAdmin using a WordPress plugin.
Use a Plugin to Access phpMyAdmin
If you don’t want to go through all the steps from the above section or if you can’t access phpMyAdmin from your hosting control panel of if you don’t know the login details, then you can use the WP phpMyAdmin plugin on your WordPress website. It will allow you to easily access the phpMyAdmin area from your WordPress dashboard.
After activating this plugin, you will see an option called WP-phpMyAdmin in the left-hand menu on your WordPress dashboard. Click on that to open the plugin page. Then you will see a button saying Enter phpMyAdmin. Clicking on that button will open phpMyAdmin with only one database which belongs to the website where you installed the plugin. It won’t even ask for login details. So, accessing phpMyAdmin and your WordPress database should be easier this way.
However, if this doesn’t work for you then you can follow the instruction on the WP phpMyAdmin plugin page beside the “phpMyAdmin on hosting” option.
Retrieve Your Key from the Database
Now you have successfully logged into phpMyAdmin and you know which database belongs to the website in question. So, click on the database name from the left-side navigation panel to see options for that database.
Then you will see a few tabs at the top bar on the screen. From there, click on the Search button to search for related keywords that might return the information you are looking for. Instead of using the search button, you can also use the Export button to export the entire database on your computer. Then you can open the database file in a text editor on your computer and then make the searches there. See the below sections to find out what kind of keywords you can use to find the information you are looking for.
After clicking on the database name, click on the Search button from the top bar. Then type any relevant keyword on the search box and then press enter. This will return all the tables on the database where you will see the number of matches on each of those databases.
If there is any match in any of the tables, then you will see a Browse link beside that table name. Clicking on that link will show you the matching data represented in rows and columns. But if there are many matching data in a table, then you will not see all the data on the page. In that case, you will need to either increase the numbers of rows shown on a page or browse to all the subsequent pages to see all the data.
If you don’t see all the texts in a cell because of insufficient space, then you can double click on the cell to go to the editing mode which will open let you see all the texts in that field. Then when your inspection with the data is finished, you can simply click on any white space on the page to go out of editing mode. You can also click on the Edit link in any row to open an editing window for information on that row. Additionally, you can select any row and click on the Export link to download that data in your computer to inspect the data locally.
You can go through all the search results in this way to find your required information. But if you want a single document containing all the database information, then you can follow the next section to be able to download the entire database on your computer and then to inspect them locally.
After clicking on the database name of your website from phpMyAdmin, click on the Export button from the top bar and then click on the Go button to export your entire database to your computer.
Now open that downloaded database file with a code editor or with a text editor of your choice. There you can search for relevant keywords that are related to the information you are trying to find. And the search result will take you to all the locations where matches are found. Then to find out the information you are looking for, you can inspect the texts that are in the same line with the matched keywords. However, all the texts in the matched keyword line may not fit in one line because of having many texts in one line. Therefore, you might need to scroll right to see all the texts in that line or if there is line wrapping then you will see that one line takes multiple lines to allow you to see all the texts without scrolling. You will see a number at the beginning of each new line which will help you identify where a line started and where it ended. By using this searching technique, you will be able to use your WordPress database to find out the information you are looking for.
Because your WordPress database will have a lot of information, it will be easier to search for various related keywords than manually checking for the information on the database.
Use Keywords You Already Know
You may already know some keywords related to the information that you are looking for. For instance, if you are looking for a password, then you can search the database using the username that you have used with that password. Then when the search takes you to the username location on the database, you can look into the texts around that username to see if you find that password.
Additionally, if you already know a part of the key, then you can search for that part on the database which will return all the matching texts. You can then go through the matching texts to retrieve the correct key.
Use Related Keywords
If you are trying to find any key or other information for a plugin or theme, then you can try searching for that plugin name or the theme name. Then go through the matching results and see if any texts around the matched text give you the information you are looking for.
Additionally, if you are searching for any API key or License key, then you can search for keywords like key, api, license, and so on. And then inspect the texts around the matched keywords to see if they match your requirement.
Also, if you are looking for any username or password then you can search for keywords like user, username, pass, password, and so on.