If you’ve just moved your WordPress install between servers or hosting providers, you might need to update your database connection details. These are stored on the server in a PHP file called wp-config.php.
This will open a text file full of configuration variables and some explanatory text. Up towards the top is our database connection information:
/** The name of the database for WordPress */
define('DB_NAME', 'database_name');
/** MySQL database username */
define('DB_USER', 'database_username');
/** MySQL database password */
define('DB_PASSWORD', 'database_password');
Check that these three variables are correct based on your records at actual host. If they don't look right, update as appropriate
Another thing that you can try is a database repair.
Wordpress provides a built-in utility to repair the database. It is disabled by default, because it has no access controls and could be a security issue. We will enable the feature, run the repairs, and then disable it.
Open up the wp-config.php file again:
On any blank line, paste in the following:
define('WP_ALLOW_REPAIR', true);
This defines a variable that WordPress looks for when determining if it should enable the repair feature.
Save and close the file. Switch over to your browser and load the following address, being sure to substitute your site’s domain or IP address for the highlighted portion:
https://www.example.com/wp-admin/maint/repair.php
A database repair page will load. Press the Repair Database button, and you’ll be taken to a results page where you can see the checks and repairs happening in real-time.
Once the process finishes, be sure to open up the wp-config.php file again and remove the line we just pasted in.
Hope this will help you fix your database connection issue.
]]>