I have been looking for the solution to this problem for many days. Unfortunately, I couldn’t find anything useful. Any help would be really appreciated as I am in a semi panic mode: my nextcloud instance does not work and I cannot bring it up.
Nextcloud version: 16.0.4
Operating system and version: Synology DSM
Apache or nginx version: Apache 2.4.39
PHP version: 7.2
I have been updating my Nextcloud (from 16.0.4 to 16.0.5) as I have been always doing: using cli.
First I did
sudo -u http php72 updater.phar
and everything went absolutely fine. Then I started upgrading with
sudo -u http php72 ./occ upgrade
and this is where the strangest things happened. I got a huge list of errors. They started as
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory in /volume1/web/nexctcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /volume1/web/nexctcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(448): OC\DB\Connection->connect()
#1 /volume1/web/nexctcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(410): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /volume1/web/nexctcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(354): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /volume1/web/nexctcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(710): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /volume1/web/nexctcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
It looks like occ cannot connect to the database. But why and how to fix it? As I said, I always did exactly the same steps to upgrade and never had such problems before. I don’t know where even to begin looking for a solution as I couldn’t find anything useful on the web.
The output of your config.php file in /path/to/nextcloud
:
<?php
$CONFIG = array (
'instanceid' => '***',
'passwordsalt' => '***',
'secret' => '***',
'trusted_domains' =>
array (
0 => '***.org',
),
'datadirectory' => '/volume1/nc_data',
'overwrite.cli.url' => 'https://192.168.1.10/nextcloud',
'dbtype' => 'mysql',
'version' => '16.0.4.1',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_***',
'dbpassword' => '***',
'logtimezone' => 'UTC',
'installed' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'mail_smtpmode' => 'smtp',
'maintenance' => true,
'theme' => '',
'loglevel' => 2,
'updater.release.channel' => 'stable',
'mail_from_address' => '***',
'mail_smtpauthtype' => 'LOGIN',
'mail_domain' => '***',
'mail_smtpsecure' => 'ssl',
);