WordPress Database Connection Error Checklist
The error establishing a database connection message usually means WordPress cannot connect to MySQL or MariaDB. This can be caused by wrong database credentials, a stopped database service, full disk, corrupted tables or server overload.
Common causes
- Wrong database name, user or password in wp-config.php.
- MySQL or MariaDB is stopped.
- Disk is full.
- Database server is overloaded.
- Database user has missing privileges.
- Recent migration changed credentials.
Checklist
- Check whether the error affects the whole site.
- Check database service status.
- Check disk usage.
- Check RAM usage.
- Open wp-config.php and verify database credentials.
- Check if the database exists.
- Check if the database user has privileges.
- Review recent migrations or password changes.
- Restart database service only if needed.
- Test the site again.
Final check
The site is recovered when MySQL is active, credentials are correct, disk is not full and WordPress can load both frontend and wp-admin.
When to Use This Checklist
Use this checklist when WordPress shows Error establishing a database connection on a VPS or hosting environment.
Required Tools
SSH access, wp-config.php, MySQL or MariaDB access, database credentials, VPS terminal
Before You Start
Do not reset database passwords before checking wp-config.php and database service status.
Structured Checklist Steps
- Confirm the whole site is affected.
- Check MySQL status.
- Check disk usage.
- Check RAM usage.
- Verify DB_NAME in wp-config.php.
- Verify DB_USER.
- Verify DB_PASSWORD.
- Verify DB_HOST.
- Check database user privileges.
- Restart database service only if needed.
Verification Steps
- Database service is active.
- Disk has free space.
- wp-config.php credentials are correct.
- Frontend and wp-admin load again.
Rollback Plan
If credential changes break the site, restore the previous wp-config.php values or restore the database user password from your saved credentials.
Common Mistakes
- Changing database password without updating wp-config.php.
- Ignoring full disk.
- Restarting MySQL repeatedly without checking logs.
- Using the wrong database name after migration.
- Deleting database users by mistake.
Related Commands
sudo systemctl status mysql
df -h
free -h
grep DB_ wp-config.php
mysql -u db_user -p
sudo systemctl restart mysql