This error appears when WordPress can't communicate with your database. Here’s how to fix it step-by-step:
wp-config.php
FileOpen your wp-config.php
file and verify these lines:
define('DB_NAME', 'your_db_name');
define('DB_USER', 'your_db_user');
define('DB_PASSWORD', 'your_db_password');
define('DB_HOST', 'localhost');
Some hosts use an IP or custom URL instead of localhost
. Contact your host if unsure.
Add this line to wp-config.php
before /* That's all, stop editing! */
:
define('WP_ALLOW_REPAIR', true);
Then visit: http://yourdomain.com/wp-admin/maint/repair.php
Click on Repair Database or Repair and Optimize Database, then remove the line.
Create a file testdb.php
in your root folder:
<?php
$mysqli = new mysqli('localhost', 'db_user', 'db_password', 'db_name');
if ($mysqli->connect_error) {
die('Connect Error: ' . $mysqli->connect_error);
} else {
echo 'Connection successful!';
}
?>
Visit http://yourdomain.com/testdb.php
to test.
Re-upload fresh wp-admin
and wp-includes
folders from a clean WordPress package. Do not overwrite wp-content
.
Ask your hosting provider: “Is the MySQL server currently running and accepting connections?”
Rename /wp-content/plugins/
to /plugins_old/
to disable all plugins temporarily.
In wp-config.php
, enable debug mode:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Check /wp-content/debug.log
for details.
Still need help? Create a technical support ticket, Back2cloud will fix it for you!.