I'm not a Magento developer but when a client asked me to change the slider. I changed and it was an easy option. After changing, I flushed the cache, and the site showing an error msg like PDO exception as shown below

PDOException: SQLSTATE[HY000] [2002] Connection refused in /var/www/html/purpledew/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128 Stack trace: #0 /var/www/html/purpledew/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct('mysql:host=loca...', 'root', 'AccelrayPurple@...', Array) #1 /var/www/html/purpledew/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 ...

  • Please try once restarting the MySQL service such as sudo systemctl restart mysql.service and Please check log files from {magento root directory}/var/log Commented Sep 24, 2021 at 6:23

1 Answer 1


Connection needs to go to port 8889. The reason you are getting this error is because your connection is going to port 8888 and hence the error shows. Do this:

$conn = new PDO("mysql:host=$servername;port=8889;dbname=AppDatabase", $username, $password);

You may still see the error but nonetheless the connection would pass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.