Problem
While working with the system cron, you see the following error:
Could not connect to database
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
to1
(enabled), make certain that thedb_host
value matches the Common Name (CN) exactly or is a Subject Alternative Name (SAN) of the certificate that you specified fordb_tls_cert
.
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