I have this error, my database is in a service other than magento and the user used to connect to the database is admin, can you help me?
PDOException: Caught PDOException (500): SQLSTATE[HY000] [2002] Connection refused in /var/www/whitelabel/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128
#0 /var/www/whitelabel/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct()
#1 /var/www/whitelabel/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 /var/www/whitelabel/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(406): Zend_Db_Adapter_Pdo_Mysql->_connect()
1 Answer 1
This could be happening for variety of reasons but you can try few things -:
Check PHP-fpm processes running on the server
Check with hosting company may be there is some firewall rules which is preventing connectivity between Magento and MySQL
May be check overrunning cron jobs
If nothing else then restarting MySQL or PHP-fpm could help
Worth checking db permission for the given user
MySQL logs can also give you more information than just connection refused