This error means WordPress cannot connect to your database.
Why This Error Happens
- Incorrect database credentials
- Database server down
- Corrupted database tables
Method 1: Check wp-config.php
define('DB_NAME', 'database_name');
define('DB_USER', 'database_user');
define('DB_PASSWORD', 'database_password');
define('DB_HOST', 'localhost');
Method 2: Repair Database
Add this temporarily to wp-config.php:
define('WP_ALLOW_REPAIR', true);
Visit:
/wp-admin/maint/repair.php
Method 3: Contact Hosting Provider
If credentials are correct, your database server may be down.
How to Prevent This Error
- Take regular backups
- Use reliable hosting
- Avoid force-closing updates