1

I'm getting this message sporadically all of a sudden and I'm not sure how to fix it.

    [2017-04-07 20:09:32] main.CRITICAL: PDOException: SQLSTATE[HY000] [2002] 
Connection refused in /httpdocs/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128

Here is my mysql configuration in magento

array (
        'host' => 'localhost',
        'dbname' => 'database',
        'username' => 'username',
        'password' => 'password',
        'active' => '1',
      ),
  • you either have selinux or change localhost to 127.0.0.1. or check where is your mysql listening – MagenX Apr 8 '17 at 8:02
2

Try renaming your file app/etc/env.php, so run the install process again (don't worry all your data will keep saved), then run these commands below.

alias mage="php -d memory_limit=-1 -f bin/magento"
composer update -vv && composer install &&
chmod -R 777 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ vendor/magento var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage cache:clean &
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:static-content:deploy ; mage setup:static-content:deploy -f;
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 777 pub/static/ pub/media/ var/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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