I've adjusted the code which generates the message:
$message = 'Cannot connect to the configured database';
Now I get a better exception in the log. It indicates, that the MySQL Server is down (which you cannot guess based on the initial exception).
Fri, 29 Mar 2019 04:13:41 +0100 [EMERGENCY] request="c44736868e9aa" component="TYPO3.CMS.Frontend.Middleware.TypoScriptFrontendInitialization": Cannot connect to the configured database - {"exception":"Doctrine\DBAL\Driver\Mysqli\MysqliException: Connection refused in WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php:86
Stack trace:
#0 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php(36): Doctrine\DBAL\Driver\Mysqli\MysqliConnection->__construct(Array, 'DATABASE', 'PASSWORD', Array)
#1 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Driver\Mysqli\Driver->connect(Array, 'DATABASE', 'PASSWORD', Array)
#2 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/Connection.php(93): Doctrine\DBAL\Connection->connect()
#3 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(453): TYPO3\CMS\Core\Database\Connection->connect()
#4 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(413): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#5 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(357): Doctrine\DBAL\Connection->detectDatabasePlatform()
#6 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/ConnectionPool.php(166): Doctrine\DBAL\Connection->getDatabasePlatform()
#7 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/ConnectionPool.php(128): TYPO3\CMS\Core\Database\ConnectionPool->getDatabaseConnection(Array)
#8 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/ConnectionPool.php(82): TYPO3\CMS\Core\Database\ConnectionPool->getConnectionByName('Default')
#9 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php(70): TYPO3\CMS\Core\Database\ConnectionPool->getConnectionForTable('pages')
#10 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\TypoScriptFrontendInitialization->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#11 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/EidHandler.php(50): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#12 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\EidHandler->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#13 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/PreprocessRequestHook.php(57): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#14 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\PreprocessRequestHook->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#15 WEBSITEPATH/public/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php(58): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#16 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#17 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/TimeTrackerInitialization.php(49): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#18 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\TimeTrackerInitialization->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#19 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(67): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#20 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(98): TYPO3\CMS\Core\Http\MiddlewareDispatcher->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#21 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Http/Application.php(69): TYPO3\CMS\Core\Http\AbstractApplication->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#22 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(110): TYPO3\CMS\Frontend\Http\Application->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#23 WEBSITEPATH/public/index.php(24): TYPO3\CMS\Core\Http\AbstractApplication->run()
#24 WEBSITEPATH/public/index.php(25): {closure}()
#25 {main}
Next Doctrine\DBAL\Exception\ConnectionException: An exception occurred in driver: Connection refused in WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:113
Stack trace:
#0 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(184): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\Mysqli\MysqliException))
#1 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(169): Doctrine\DBAL\DBALException::wrapException(Object(Doctrine\DBAL\Driver\Mysqli\Driver), Object(Doctrine\DBAL\Driver\Mysqli\MysqliException), 'An exception oc...')
#2 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php(38): Doctrine\DBAL\DBALException::driverException(Object(Doctrine\DBAL\Driver\Mysqli\Driver), Object(Doctrine\DBAL\Driver\Mysqli\MysqliException))
#3 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Driver\Mysqli\Driver->connect(Array, 'DATABASE', 'PASSWORD', Array)
#4 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/Connection.php(93): Doctrine\DBAL\Connection->connect()
#5 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(453): TYPO3\CMS\Core\Database\Connection->connect()
#6 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(413): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#7 WEBSITEPATH/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(357): Doctrine\DBAL\Connection->detectDatabasePlatform()
#8 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/ConnectionPool.php(166): Doctrine\DBAL\Connection->getDatabasePlatform()
#9 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/ConnectionPool.php(128): TYPO3\CMS\Core\Database\ConnectionPool->getDatabaseConnection(Array)
#10 WEBSITEPATH/public/typo3/sysext/core/Classes/Database/ConnectionPool.php(82): TYPO3\CMS\Core\Database\ConnectionPool->getConnectionByName('Default')
#11 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php(70): TYPO3\CMS\Core\Database\ConnectionPool->getConnectionForTable('pages')
#12 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\TypoScriptFrontendInitialization->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#13 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/EidHandler.php(50): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#14 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\EidHandler->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#15 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/PreprocessRequestHook.php(57): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#16 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\PreprocessRequestHook->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#17 WEBSITEPATH/public/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php(58): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#18 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#19 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Middleware/TimeTrackerInitialization.php(49): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#20 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\CMS\Frontend\Middleware\TimeTrackerInitialization->process(Object(TYPO3\CMS\Core\Http\ServerRequest), Object(class@anonymous))
#21 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(67): class@anonymous->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#22 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(98): TYPO3\CMS\Core\Http\MiddlewareDispatcher->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#23 WEBSITEPATH/public/typo3/sysext/frontend/Classes/Http/Application.php(69): TYPO3\CMS\Core\Http\AbstractApplication->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#24 WEBSITEPATH/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(110): TYPO3\CMS\Frontend\Http\Application->handle(Object(TYPO3\CMS\Core\Http\ServerRequest))
#25 WEBSITEPATH/public/index.php(24): TYPO3\CMS\Core\Http\AbstractApplication->run()
#26 WEBSITEPATH/public/index.php(25): {closure}()
#27 {main}"}