Unable to Connect Errors


While working with the database, you see the following error:

Critical Error - Unable to connect to the database

This error is not the same as the Could not connect to database error that you may see while working with the system cron. For more information, see Could not Connect Errors.


This error indicates that the system cannot connect to your database.

You can find more details about the error by enabling error reporting and reloading the page.


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.

For more information, see The 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.

For help, contact your hosting provider or system administrator.

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: June 24, 2024