Problems connecting to MySQL 8. Anyone run into this?


Well-known member
This is basically the extent of the error message:
An exception occurred: [XF\Db\Exception] (trying to connect via (null)) in src/XF/Db/Mysqli/Adapter.php on line 165

I am able to connect via the CLI and run update scripts, but I am not able to load the site at all through the browser. Hopefully, someone has run into this and has a fix. Thanks.
Have you checked to make sure the PECL's are loaded and recognized via your PHP processing procesess for your HTTP server. Don't know if you are using Apache, LightSpeed or nginx... but it can make a difference.
Also make sure your firewall is not blocking the port.
Thank you for the replies, let me give you some additional context as I have been doing some more digging.

I am attempting to use Linode managed DBs and the error number being returned is 2002. This is some sort of connection error that I believe is related to the secure connection. I have downloaded there CA cert and added it to the DB config:

$databaseInfo = [
    'host' => '[HOST]',
    'port' => '[PORT]',
    'username' => '[USERNAME]',
    'password' => '[PASSWORD]',
    'dbname' => '[DBNAME]',
    'ssl' => [
        'enabled' => true,
        'ca' => '[CA_CERT_FILE_PATH]'

I am using NGINX and PHP 8.1. Here is my NGINX config for running PHP:

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php8.1-fpm.sock;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;

I will check to make sure the PECL are loaded properly and the firewall is set correctly because I can connect to the mysql server through the command line.
Another quick note, I can run all my XF CLI commands that connect to the DB no problem. The issue occurs when I try to load any page through a browser. So weird, but I am digging into the NGINX conf and possible SSL conf issues.
Top Bottom