Unable to Connect Errors
Problem
While working with the database, you see the following error:
Critical Error - Unable to connect to the database
Could not connect to database
error that you may see while working with the system cron. For more information, see Could not Connect Errors.Cause
This error indicates that the system cannot connect to your database.
Solution
Check and update the database connection details in the configuration.php
file.
For example, you may need to make corrections if you recently changed the password or renamed the database itself. This could also be an issue with MySQL® or an empty configuration.php
file.
Database User
If you have confirmed that the database name, username, and password are correct, make certain that the MySQL user is assigned to the desired database and has full access.
Recent PHP Changes
If you have made recent changes to your PHP version or configuration, check whether the pdo_mysql
PHP extension is installed and your system meets all of our system requirements.
If this is the problem, you will usually see the following error:
Critical Error - Could not connect to the $db_name database. PDO extension not found
Encrypted MySQL Connections
You may receive this error if your server requires encrypted MySQL connections (--require_secure_transport
is ON
in the server configuration).
- In WHMCS 8.7 and earlier, you cannot use encrypted MySQL connections and must update the server’s settings.
- In WHMCS 8.8 and later, update the
configuration.php
file before you can successfully use encrypted connections.For more information, see Enable Encrypted MySQL.
Last modified: November 19, 2024