Let’s say you are a WordPress site owner who has recently migrated from an old hosting company to a new one. Your new hosting provider handled the migration for you, so you expect everything to work just as it did prior to the migration. Everything seems well until you get an automated e-mail telling you that your WordPress installation could not be automatically updated because the script did not have access to your WordPress database. What’s the problem?
Database access errors are not all that uncommon after migrations. Most of the time, the person responsible for the migration updates everything so that the transition is seamless to the site owner. But every once in a while, something will be missed. More often than not, the one thing that gets missed in migration is the database name and username needed for administrative access.
The good news here is that correcting this kind of error is very easy to do. You don’t even need help from the support department at your host. You can do it yourself in two easy steps.
#1 – Retrieve the Old Information
The first step is to retrieve your old database name, username, and password just to make sure there really is a conflict. You can do this by logging into cPanel (or whatever control panel your hosting company provides) and go to the WordPress script section where you’ll find your active installations. Choose the installation in question and click on the ‘edit details’ icon – it looks like a pencil. This will bring up a new window that shows your database configuration as recorded by WordPress itself.
In this configuration, you should see the old username and password assigned to your database. They may look something like this:
- Database Name: sitename_db01
- Database User: sitename_db01
- Database Password: ********
#2 – Retrieve the New Information
The second step is to retrieve the information assigned by your new hosting provider. So, open the cPanel file browser in a new browser tab. Search for a file named ‘wp-config.php’ – it’s usually found either in the root directory of your WordPress installation or the ‘public_html’ folder. Download this file and open it in a text editor.
You shouldn’t have to scroll down too far to find the same information listed above. If the information in this file differs from what you found in your WordPress installation, you have discovered why you are having a database access problem. All you need to do is copy the information from the ‘wp-config.php’ into the WordPress configuration editor and save your changes. You should now be able to back up your installation and do other administrative tasks without any database access errors.
If the database name, username and password information agree in both places, the above solution will not work. You might have a corrupt database that must be manually examined and repaired. Let’s hope this is not the case. It’s a lot easier just to follow the two steps outlined here.