Failed to connect to the database: An exception occurred in the driver: SQLSTATE

Hi Guys, we are trying to get nexcloud to work on our Qnap Nas and have successfully installed it but we are runing into an issue now.

we cant seem to get it to work due to this error:

Exception
Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused
/var/www/html/3rdparty/doctrine/dbal/src/Connection.php
line 1654
OC\DB\Connection->connect()
/var/www/html/3rdparty/doctrine/dbal/src/Connection.php
line 1081
Doctrine\DBAL\Connection->getWrappedConnection()
/var/www/html/lib/private/DB/Connection.php
line 261
Doctrine\DBAL\Connection->executeQuery(
“SELECT * FROM oc_appconfig”,
,
,
null
)
/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php
line 337
OC\DB\Connection->executeQuery(
“SELECT * FROM oc_appconfig”,
,
,
null
)
/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php
line 377
Doctrine\DBAL\Query\QueryBuilder->executeQuery()
/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php
line 280
Doctrine\DBAL\Query\QueryBuilder->execute()
/var/www/html/lib/private/AppConfig.php
line 421
OC\DB\QueryBuilder\QueryBuilder->execute()
/var/www/html/lib/private/AppConfig.php
line 187
OC\AppConfig->loadConfigValues()
/var/www/html/lib/private/AppConfig.php
line 377
OC\AppConfig->getApps()
/var/www/html/lib/private/legacy/OC_App.php
line 734
OC\AppConfig->getValues(
false,
“installed_version”
)
/var/www/html/lib/private/TemplateLayout.php
line 236
OC_App::getAppVersions()
/var/www/html/lib/private/legacy/OC_Template.php
line 142
OC\TemplateLayout->__construct(
“error”,
“”
)
/var/www/html/lib/private/Template/Base.php
line 132
OC_Template->fetchPage()
/var/www/html/lib/private/legacy/OC_Template.php
line 291
OC\Template\Base->printPage()
/var/www/html/index.php
line 104
OC_Template::stuck_out_tongue:rintExceptionErrorPage(
[
“Doctrine\DBAL\Exception”
],
500
)
Raw log entry
{
“reqId”: “RG7bBOUcQ8gbfeHNH0XK”,
“level”: 3,
“time”: “2024-03-26T09:57:32+00:00”,
“remoteAddr”: “223.186.79.23”,
“user”: “–”,
“app”: “core”,
“method”: “GET”,
“url”: “/favicon.ico”,
“message”: “Exception thrown: Doctrine\DBAL\Exception”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0”,
“version”: “28.0.3.2”,
“exception”: {
“Exception”: “Doctrine\DBAL\Exception”,
“Message”: “Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused”,
“Code”: 2002,
“Trace”: [
{
“file”: “/var/www/html/3rdparty/doctrine/dbal/src/Connection.php”,
“line”: 1654,
“function”: “connect”,
“class”: “OC\DB\Connection”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/3rdparty/doctrine/dbal/src/Connection.php”,
“line”: 1081,
“function”: “getWrappedConnection”,
“class”: “Doctrine\DBAL\Connection”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/DB/Connection.php”,
“line”: 261,
“function”: “executeQuery”,
“class”: “Doctrine\DBAL\Connection”,
“type”: “->”,
“args”: [
“SELECT * FROM oc_appconfig”,
,
,
null
]
},
{
“file”: “/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php”,
“line”: 337,
“function”: “executeQuery”,
“class”: “OC\DB\Connection”,
“type”: “->”,
“args”: [
“SELECT * FROM oc_appconfig”,
,
,
null
]
},
{
“file”: “/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php”,
“line”: 377,
“function”: “executeQuery”,
“class”: “Doctrine\DBAL\Query\QueryBuilder”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php”,
“line”: 280,
“function”: “execute”,
“class”: “Doctrine\DBAL\Query\QueryBuilder”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/AppConfig.php”,
“line”: 421,
“function”: “execute”,
“class”: “OC\DB\QueryBuilder\QueryBuilder”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/AppConfig.php”,
“line”: 187,
“function”: “loadConfigValues”,
“class”: “OC\AppConfig”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/AppConfig.php”,
“line”: 377,
“function”: “getApps”,
“class”: “OC\AppConfig”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/legacy/OC_App.php”,
“line”: 734,
“function”: “getValues”,
“class”: “OC\AppConfig”,
“type”: “->”,
“args”: [
false,
“installed_version”
]
},
{
“file”: “/var/www/html/lib/private/TemplateLayout.php”,
“line”: 236,
“function”: “getAppVersions”,
“class”: “OC_App”,
“type”: “::”,
“args”:
},
{
“file”: “/var/www/html/lib/private/legacy/OC_Template.php”,
“line”: 142,
“function”: “__construct”,
“class”: “OC\TemplateLayout”,
“type”: “->”,
“args”: [
“error”,
“”
]
},
{
“file”: “/var/www/html/lib/private/Template/Base.php”,
“line”: 132,
“function”: “fetchPage”,
“class”: “OC_Template”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/legacy/OC_Template.php”,
“line”: 291,
“function”: “printPage”,
“class”: “OC\Template\Base”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/index.php”,
“line”: 104,
“function”: “printExceptionErrorPage”,
“class”: “OC_Template”,
“type”: “::”,
“args”: [
[
“Doctrine\DBAL\Exception”
],
500
]
}
],
“File”: “/var/www/html/lib/private/DB/Connection.php”,
“Line”: 139,
“CustomMessage”: “Exception thrown: Doctrine\DBAL\Exception”
},
“id”: “6602c0b2dde57”
}

Please let me know if anyone have run into this issue before as it is riving us crazy and cant solve it. Many thanks.