Magento CRITICAL Site Down: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

magento.stackexchange https://magento.stackexchange.com/questions/273247

  •  28-02-2021
  •  | 
  •  

Question

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!

No correct solution

OTHER TIPS

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
    
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top