Quick Summary
This error means your website code cannot communicate with your MySQL or MariaDB database. It is typically caused by incorrect database login credentials in your configuration file, corrupted database tables, or exhausted database user privileges.
Common Causes & Step-by-Step Fixes
1. Verify Credentials in wp-config.php
The most common cause of a database connection error is a mismatch between your database credentials and what WordPress expects.
-
Log into your hosting control panel and open the File Manager.
-
Navigate to your site's root directory (
public_html). -
Edit the
wp-config.phpfile and locate the following lines:define( 'DB_NAME', 'your_database_name' ); define( 'DB_USER', 'your_database_user' ); define( 'DB_PASSWORD', 'your_database_password' ); define( 'DB_HOST', 'localhost' ); -
Verify that
DB_NAME,DB_USER, andDB_PASSWORDmatch the active database and user created on your hosting server.
2. Verify Database User Permissions
Even if the username and password are correct, the database user must have full privileges assigned to that specific database.
- Open MySQL Databases in your control panel.
- Scroll to the Add User to Database section.
- Ensure your database user is assigned to the correct database with ALL PRIVILEGES granted.
3. Repair a Corrupted Database Table
If your credentials are correct, a database table may have become corrupted during a plugin update or unexpected site crash.
-
Open
wp-config.phpin your File Manager. -
Add the following line just above
/* That's all, stop editing! Happy publishing. */:define( 'WP_ALLOW_REPAIR', true ); -
Save the file and visit
[https://yourdomain.com/wp-admin/maint/repair.php](https://yourdomain.com/wp-admin/maint/repair.php)in your browser. -
Click Repair Database.
-
Important: Once repaired, remove that line from
wp-config.phpto secure your application.
Still Having Issues?
- Hosting Support: If you are hosted on GaugeHosting.com, open a ticket under Support in your client portal so our technical engineers can check database service availability and server health.
- Custom Development & Site Repair: If you need hands-on assistance repairing custom code, broken WordPress installations, or ongoing site maintenance, contact the web development team at Horizon Web Services for dedicated technical management.