A database connection error means that the website cannot successfully connect to the database it needs to retrieve or store information.
For WordPress, common causes include incorrect database credentials in wp-config.php, a database server problem, or a database user that does not have the required permissions.
Check the following:
- Database name: Make sure the application references the correct database.
- Database username and password: Confirm that the credentials are correct.
- Database privileges: Verify that the database user has the necessary permissions.
- Database server: Check whether MySQL or MariaDB is running and accessible.
- Resource limits: Excessive database connections or server resource usage may prevent new connections.
- Database integrity: In some cases, database tables may be damaged.
On cPanel hosting, check the database name, user, and assigned privileges through MySQL Databases.
Do not reset credentials or repair database tables without first understanding the configuration and taking a backup where possible.
If the credentials are correct but the error continues, the hosting provider may need to investigate the database service and server logs.