Tsohost Help Centre

Table of Contents

Update WordPress database connection string

Updated May 5th at 13:56 BST

If your WordPress site is out of sync with your database and displays the following error: "Error Connecting to the Database", you'll need to update the connection strings on your WordPress site.

Note: You should always backup your site before performing any troubleshooting.

Locate your database details.

Edit the wp-config.php for your website. The wp-config.php file can be found within your Managed WordPress Dashboard -> Tools -> File Browser -> Open

In wp-config.php file, locate the section that looks like this example:

            /** The name of the database for WordPress */
            define('DB_NAME', 'yourdatabasename');
            /** MySQL database username */
            define('DB_USER', 'yourusername');
            /** MySQL database password */
            define('DB_PASSWORD', 'yourpassword');
            /** MySQL hostname */
            define('DB_HOST', 'yourhostname');

            $table_prefix  = 'yourtableprefix';

Confirm the information in this file matches the database details you found earlier.

        Replace yourdatabasename with your MySQL Database Name
        Replace yourusername with your MySQL User Name
        Replace yourpassword with your MySQL password
        Replace yourhostname with your MySQL Host Name
        Replace yourtableprefix with your Table Prefix

If any of the information in the wp-config.php file doesn't match your database details, then update the file with the correct information.

Save the updated file.

Check your website to verify it's back online.