Could Not Connect Errors

Problem

While working with the system cron, you see the following error:

Could not connect to database

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

Cause

This error indicates that the cron.php script cannot access your MySQL® database. This often occurs because of a misconfiguration in the configuration.php file or because a required PHP extension is missing.

Solution

To resolve this issue, first check your database settings in the configuration.php file.

  • Make certain that all of your database settings are correct.
  • If you set db_tls_verify_cert to 1 (enabled), make certain that the db_host value matches the Common Name (CN) exactly or is a Subject Alternative Name (SAN) of the certificate that you specified for db_tls_cert.
For more information, see The configuration.php File and Enable Encrypted MySQL.

If you have ensured that your database settings are correct and the problem persists, the PHP configuration that the system cron runs under may be missing the following PHP extensions:

  • PDO
  • PDO MySQL
  • MySQLi

Ask your hosting provider or system administrator to check for the required extensions and any environmental limitations that may cause these problems.

Last modified: September 10, 2024