This guide helps you diagnose and fix WordPress database connection errors. You will verify your database credentials in wp-config.php, check that your database user has the correct privileges, repair corrupted tables, and rule out server-side issues.
Verify your database credentials
Log in to your control panel and open File Manager. Navigate to your WordPress root folder (usually public_html) and open wp-config.php. Look for these four lines:
define( 'DB_NAME', 'myaccount_wp' );
define( 'DB_USER', 'myaccount_wpuser' );
define( 'DB_PASSWORD', 'your_password_here' );
define( 'DB_HOST', 'localhost' );
Verify each value matches what is shown in the MySQL Databases section of your control panel. The database name and username must include the account prefix. The host should be localhost on shared hosting.
In the MySQL Databases section of your control panel, scroll to Current Databases. Your database should list the correct user in the Privileged Users column. If the user is missing, add them using the Add User to Database section and grant All Privileges.
For a full walkthrough, see How to create a MySQL database.
If you suspect the password is wrong, go to MySQL Databases in your control panel and click Change Password next to the database user. Set a new password, then update the DB_PASSWORD value in wp-config.php to match.
Repair the database
If the credentials are correct but the error persists, the database may have corrupted tables. Add this line to wp-config.php:
define( 'WP_ALLOW_REPAIR', true );
Then visit https://yourdomain.com/wp-admin/maint/repair.php in your browser. Click Repair Database (or Repair and Optimize Database for a more thorough fix). Once complete, remove the WP_ALLOW_REPAIR line from wp-config.php — leaving it active is a security risk.
Alternatively, open phpMyAdmin from your control panel, select your WordPress database, tick the tables showing errors (or select all), and choose Repair Table from the dropdown.
Check server status
In rare cases, the MySQL server itself may be temporarily down. If you see the error on multiple sites on your account, or if phpMyAdmin also fails to load, the database server may need to be restarted. On shared hosting, this is handled by HOSTDOG's infrastructure team. Open a support ticket and we will investigate immediately.
If the error only affects the WordPress admin area but the front-end loads, check if your wp_options table has a corrupted siteurl or home value. You can verify and correct these in phpMyAdmin.