Cant connect to DB on 22.2.3.0?

Nextcloud version (eg, 20.0.5): 22.0.3
Operating system and version (eg, Ubuntu 20.04): ubuntu 22.0.4.1
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52 (Ubuntu)
PHP version (eg, 7.4): 7.4

The issue you are facing:

Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /srv/nextcloud/lib/private/DB/Connection.php:87

Every google result says something about postgres or mariadb. Im not using either. Im using mysql. netstat shows sql listening on 3306. I was on version 21 so I’ve been trying to go through the upgrades because the web UI update was giving me some other error so now I’ve been upgrading manually. Now Im on 22.0.3 trying to keep going but cant because now my DB wont connect.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. sudo -u www-data php7.4 /srv/nextcloud/occ upgrade

The output of your Nextcloud log in Admin > Logging:

I cant log in to obtain this. Instance is broken. Updating via cli. 

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocnhsbxdr75n',
  'passwordsalt' => 'salt',
  'secret' => 'secretkey',
  'default_phone_region' => 'US',
  'session_lifefime' => 600,
  'session_keepalive' => false,
  'remember_login_cookie_lifetime' => 660,
  'trusted_domains' =>
  array (
    0 => '10.20.2.172',
    1 => 'https://photos.mydomain.com',
  ),
  'overwriteprotocol' => 'https',
  'overwritehost' => 'photos.mydomain.com',
  'datadirectory' => '/opt/data',
  'dbtype' => 'mysql',
  'version' => '22.2.3.0',
  'overwrite.cli.url' => 'https://photos.mydomain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'dbuser',
  'dbpassword' => 'dbpw',
  'mysql.utf8mb4' => true,
  'installed' => true,
  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\TIFF',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\Font',
    11 => 'OC\\Preview\\MP3',
    12 => 'OC\\Preview\\Movie',
    13 => 'OC\\Preview\\MKV',
    14 => 'OC\\Preview\\MP4',
    15 => 'OC\\Preview\\AVI',
  ),
  'app_install_overwrite' =>
  array (
    0 => 'previewgenerator',
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
  ),
  'updater.secret' => 'secretkey',
  'maintenance' => true,
  'theme' => '',
  'loglevel' => 2,
);

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

https://pastebin.com/raw/DhS2AhEN
php -m
[PHP Modules]
apcu
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
json
libxml
mbstring
memcache
memcached
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache