WordPress attempts to open a MySQL connection using values from wp-config.php. If MySQL rejects the request, WordPress stops loading and shows a database error.
The error appears when credentials are wrong, the MySQL service is down, tables are corrupted, or server resources are insufficient. It also occurs when firewall blocks the host or when version mismatch prevents required features.