Failed to connect to the database

help

#1

Steps to reproduce

  1. Date: April 2018 - Google Cloud Platform - Deploy a predesigned solution (Marketplace) - ownCloud Certified by Bitnami
  2. Running correct (It was not modified, since the initial installation)
  3. Date: May 08, 2019: Exception occurred while logging exception: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused

Expected behaviour

Tell us what should happen
Web interface of ownCloud

Actual behaviour

Tell us what happens instead

Exception occurred while logging exception: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused
#0 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /opt/bitnami/apps/owncloud/htdocs/lib/private/DB/Connection.php(145): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /opt/bitnami/apps/owncloud/htdocs/lib/private/DB/ConnectionFactory.php(145): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(493): OC\DB\ConnectionFactory->getConnection(‘mysql’, Array)
#8 /opt/bitnami/apps/owncloud/htdocs/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#9 /opt/bitnami/apps/owncloud/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet(‘DatabaseConnect…’)
#10 /opt/bitnami/apps/owncloud/htdocs/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query(‘DatabaseConnect…’)
#11 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(1160): OC\ServerContainer->query(‘DatabaseConnect…’)
#12 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(370): OC\Server->getDatabaseConnection()
#13 /opt/bitnami/apps/owncloud/htdocs/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#14 /opt/bitnami/apps/owncloud/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet(‘AppConfig’)
#15 /opt/bitnami/apps/owncloud/htdocs/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query(‘AppConfig’)
#16 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(1089): OC\ServerContainer->query(‘AppConfig’)
#17 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(547): OC\Server->getAppConfig()
#18 /opt/bitnami/apps/owncloud/htdocs/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#19 /opt/bitnami/apps/owncloud/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet(‘AppManager’)
#20 /opt/bitnami/apps/owncloud/htdocs/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query(‘AppManager’)
#21 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(1359): OC\ServerContainer->query(‘AppManager’)
#22 /opt/bitnami/apps/owncloud/htdocs/lib/private/legacy/app.php(346): OC\Server->getAppManager()
#23 /opt/bitnami/apps/owncloud/htdocs/lib/private/legacy/app.php(110): OC_App::getEnabledApps()
#24 /opt/bitnami/apps/owncloud/htdocs/lib/base.php(579): OC_App::loadApps(Array)
#25 /opt/bitnami/apps/owncloud/htdocs/lib/base.php(998): OC::init()
#26 /opt/bitnami/apps/owncloud/htdocs/index.php(54): require_once(’/opt/bitnami/ap…’)
#27 {main}

Server configuration

Operating system:
Debian (9)
Web server:
Apache (2.4.29)
Database:
MySQL (5.7.21)
PHP version:
PHP (7.0.28)
ownCloud version: (see ownCloud admin page)
ownCloud (10.0.7)
Updated from an older ownCloud or fresh install:

Where did you install ownCloud from:

Signing status (ownCloud 9.0 and above):

The content of config/config.php:

$CONFIG = array ( ‘passwordsalt’ => ‘#####’,
‘secret’ => ‘########’,
‘trusted_domains’ => array ( 0 => ‘127.0.0.1’, 1 => ‘35.194.21.102’, 2 => ‘####.org’, ),
‘datadirectory’ => ‘/opt/bitnami/apps/owncloud/data’,
‘overwrite.cli.url’ => ‘http://localhost’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘10.0.7.2’,
‘dbname’ => ‘b######’,
‘dbhost’ => ‘127.0.0.1:/opt/bitnami/mysql/tmp/mysql.sock’,
‘dbtableprefix’ => 'oc
’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘b#_####’,
‘dbpassword’ => ‘#####’,
‘logtimezone’ => ‘UTC’,
‘installed’ => true,
‘instanceid’ => ‘#####’,
‘openssl’ => array ( ‘config’ => ‘/opt/bitnami/common/openssl/openssl.cnf’, ),


#2

This looks very unusual. Where does it come from?


#3

VM Instances - Compute Engine from Google Cloud Platform

Please contact me

mandujano.net@gmail.com
Whatsapp +51 969959924
Instagram @mandujanorubin


#4

No thanks, sorry.

  1. Solution of your issue should remain in this forum.
  2. I don’t have an experience with VM and whatever Google Cloud Platform is.

#5

Very obviously your database cannot be reached. You might want to check the following things:

  • Is the database up and running
  • Do you use the correct credentials for the database?
  • Is there a firewall, which might block the service?
  • Can you reach the database from the ownCloud root directory with your credentials using a simple connection script?

Basically, since you use a service which states to be Certified by Bitnami, I’d recommend to contact them first, sure they know best about their own environment.