0

I had installed Magento2 in Xampp earlier and now I am trying it removing xampp with local apache2, php and mysql server. I have used the backup database and the previously used Magento2 folder here.

When I tried to access the website as 127.0.0.1/magento2, I am getting the following error. But I can log in to mysql server with mysql - root -p with password correctly. What can be the reason?

PDOException: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128 Stack trace: #0 /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct('mysql:host=loca...', 'root', 'root', Array) #1 /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 /var/www/magento2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(398): Zend_Db_Adapter_Pdo_Mysql->_connect() #3 /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #4 /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT store_w...', Array) #5 /var/www/magento2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(517): Zend_Db_Adapter_Pdo_Abstract->query('SELECTstore_w...', Array) #6 /var/www/magento2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(580): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_w...', Array) #7 /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(737): Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select), Array) #8 /var/www/magento2/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(87): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select))

9 /var/www/magento2/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(57):

Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') #10 /var/www/magento2/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Store\App\Config\Source\RuntimeConfigSource->get('') #11 /var/www/magento2/generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php(95): Magento\Framework\App\Config\ConfigSourceAggregated->get('') #12 /var/www/magento2/vendor/magento/module-store/App/Config/Type/Scopes.php(63): Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() #13 /var/www/magento2/vendor/magento/framework/App/Config.php(131): Magento\Store\App\Config\Type\Scopes->get('websites') #14 /var/www/magento2/vendor/magento/module-store/Model/WebsiteRepository.php(182): Magento\Framework\App\Config->get('scopes', 'websites', Array) #15 /var/www/magento2/vendor/magento/module-store/Model/WebsiteRepository.php(141): Magento\Store\Model\WebsiteRepository->initDefaultWebsite() #16 /var/www/magento2/vendor/magento/module-store/Model/StoreResolver/Website.php(46): Magento\Store\Model\WebsiteRepository->getDefault() #17 /var/www/magento2/vendor/magento/module-store/Model/StoreResolver.php(140): Magento\Store\Model\StoreResolver\Website->getAllowedStoreIds(NULL)

18 /var/www/magento2/vendor/magento/module-store/Model/StoreResolver.php(126):

Magento\Store\Model\StoreResolver->readStoresData() #19 /var/www/magento2/vendor/magento/module-store/Model/StoreResolver.php(89): Magento\Store\Model\StoreResolver->getStoresData() ..... and so on..

  • Please check the mysql access details and update those on app/etc/env.php – Sukumar Gorai May 31 '18 at 10:50
  • Check you give proper permission to user and also try with changing password. – Dhiren Vasoya May 31 '18 at 13:10

Your Answer

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

Browse other questions tagged or ask your own question.