The upgrade to PHP 8.2 introduces stricter type handling and removes several legacy functions. When WordPress or a plugin calls a removed function such as mysql_connect or passes null where a string is required, PHP throws a fatal error before the database connection is attempted.
Additionally, PHP 8.2 changes default settings like mysqli.allow_local_infile and may alter the socket path used by MySQL. If wp-config.php contains null values or an outdated host definition, the connection fails immediately.