0

I changed the password in Magento admin panel and cleared the cache via the dashboard. Then my website went completely offline, only to display the multiple lines of text with the 2 exceptions mentioned.

It seems as though the database information within env.php might be encrypted because it has an additional array.

env.php file:

'crypt' => 
array ( 
  'key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' (//not real key)

The following is the error log received when trying to access site:

Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

Exception #1 (PDOException): SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

I'm a non-tech guy with novice experience with web development. Any help would be appreciated!

  • Open your env.php file in app/etc directory. Check the database credentials there – Raj Mohan R May 2 '19 at 17:59
1

The error says MySQL credentials are invalid, please check database credentials in app/etc/env.php. If the password is not correct, update the right one. If the password is correct, try the below steps.

  1. Run the below commands from the Magento root folder

    rm -rf generated/code/* generated/metadata/*
    php bin/magento ca:fl
    
  2. If you are using php-fpm, you need to restart the php-fpm service as well. Please change the below command depends on the PHP version.

    service php7.1-fpm restart
    
| improve this answer | |
  • I'm still unable to connect to the MySQL server. Does this function ['crypt' => array ( 'key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] encrypt the password within 'app/etc/env.php' when connecting to server? Can't seem to connect with PuTTY terminal. – Johnny Chiu May 2 '19 at 16:59
  • did you check the mysql credential? – Bilal Usean May 2 '19 at 17:00
  • I updated the Magento 2 admin panel password which caused this, do I update the password credentials in app/etc/env.php to match the new admin panel password? – Johnny Chiu May 2 '19 at 17:04
  • No! this error is not related to admin user password change. Check your MySQL credential, maybe someone changed without your knowledge. – Bilal Usean May 2 '19 at 17:07
  • How can I locate my MySQL credentials? I have Filezilla open but don't know the correct path to find it. – Johnny Chiu May 2 '19 at 17:21

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.