Hello,
I have recently modified the port mapping for my Nextcloud container, so I restarted the NC container and since then it is unable to connect to the MySQL DB.
Here is the output of the logs:
PHP message: PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again in /config/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /config/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /config/www/nextcloud/3rd
My config file:
<?php
$CONFIG = array (
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'redis',
'port' => 6379,
),
'datadirectory' => '/data',
'instanceid' => 'ocq371i1672w',
'passwordsalt' => '',
'secret' => '',
'trusted_domains' =>
array (
0 => '192.168.0.66'
),
'overwrite.cli.url' => 'https://192.168.0.66',
'dbtype' => 'mysql',
'version' => '15.0.2.0',
'dbname' => 'nextcloud',
'dbhost' => 'mysql',
'dbport' => '3306',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_admin2',
'dbpassword' => '',
'installed' => true,
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'mail_from_address' => '',
'mail_smtpmode' => 'smtp',
'mail_domain' => 'gmail.com',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'smtp.gmail.com',
'mail_smtpport' => '465',
'mail_smtpname' => '',
'mail_smtppassword' => '',
'mail_smtpsecure' => 'ssl',
);
I linked the NC container to the DB container using --link mysqldb:mysql
where mysqldb is tha name of the mysql container