Fatal error: Uncaught exception 'PDOException'

  • This is after installing.

    Sometimes I get:


    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused' in /public_html/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 public_html/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=10.1...', 'user', 'pass', Array) #1 /public_html/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(45): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=10.1...', 'user', 'pass', Array) #2 public_html/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'user', 'pass', Array) #3 /public_html/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(833): Doctrine\DBAL\Connection->connect() #4 /public_html/app/modules/database/src/Connection. in /public_html/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 103


    Why? How to get rid of the error?

    When refreshing a couple of times it disappear. But next day the same error message can be back again.