Error Database
"Error establishing a database connection"
This error means WordPress cannot connect to your MySQL database.
First Step: Check wp-config.php
Open the file wp-config.php at your WordPress root and check these lines:
define('DB_NAME', 'database_name');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
Database Error Causes
Incorrect Credentials
Connection info in wp-config.php is incorrect.
MySQL Server Down
Your host's MySQL service is temporarily unavailable.
Corrupted Database
Database tables are corrupted or damaged.
Incorrect Table Prefix
The prefix in wp-config.php doesn't match the tables.
Repair a Corrupted Database
Enable WordPress Repair
Add define('WP_ALLOW_REPAIR', true); in wp-config.php then access /wp-admin/maint/repair.php
Repair via phpMyAdmin
Select your database, check all tables and choose 'Repair'.
Use WP-CLI
Run wp db repair to automatically fix tables.
Complex Database Problem?
Our experts can diagnose and repair your WordPress database without data loss.
Call an Expert