3

I am using project from another computer. So I copied my project and got this error. where to change what to get rid of this error . When i try to access http://localhost/sitespi screen appear with this logs

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) in /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128 Stack trace: #0 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct('mysql:host=loca...', 'root', 'dev', Array) #1 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 /var/www/html/sitespi/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(353): Zend_Db_Adapter_Pdo_Mysql->_connect() #3 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #4 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT main_ta...', Array) #5 /var/www/html/sitespi/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(465): Zend_Db_Adapter_Pdo_Abstract->query('SELECTmain_ta...', Array) #6 /var/www/html/sitespi/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(520): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `main_ta...', Array) #7 /var/www/html/sitespi/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/html/sitespi/vendor/magento/framework/Data/Collection/Db/FetchStrategy/Query.php(21): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select), Array) #9 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(772): Magento\Framework\Data\Collection\Db\FetchStrategy\Query->fetchAll(Object(Magento\Framework\DB\Select), Array) #10 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(668): Magento\Framework\Data\Collection\AbstractDb->_fetchAll(Object(Magento\Framework\DB\Select))

11 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(572):

Magento\Framework\Data\Collection\AbstractDb->getData() #12 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(557): Magento\Framework\Data\Collection\AbstractDb->loadWithFilter(false, false) #13 /var/www/html/sitespi/vendor/magento/framework/Data/Collection.php(820): Magento\Framework\Data\Collection\AbstractDb->load() #14 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(78): Magento\Framework\Data\Collection->getIterator() #15 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(58): Magento\Config\App\Config\Source\RuntimeConfigSource->loadConfig() #16 /var/www/html/sitespi/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Config\App\Config\Source\RuntimeConfigSource->get('') #17 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Type/System/Reader.php(73): Magento\Framework\App\Config\ConfigSourceAggregated->get() #18 /var/www/html/sitespi/var/generation/Magento/Config/App/Config/Type/System/Reader/Proxy.php(95): Magento\Config\App\Config\Type\System\Reader->read() #19 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Type/System.php(212): Magento\Config\App\Config\Type\System\Reader\Proxy->read() #20 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Type/System.php(170): Magento\Config\App\Config\Type\System->loadDefaultScopeData('default')

21 /var/www/html/sitespi/vendor/magento/framework/App/Config.php(139):

Magento\Config\App\Config\Type\System->get('default/web/sec...') #22 /var/www/html/sitespi/vendor/magento/framework/App/Config.php(90): Magento\Framework\App\Config->get('system', 'default/web/sec...') #23 /var/www/html/sitespi/vendor/magento/framework/App/Config.php(103): Magento\Framework\App\Config->getValue('web/secure/use_...', 'default', NULL) #24 /var/www/html/sitespi/vendor/magento/module-store/Model/HeaderProvider/Hsts.php(48): Magento\Framework\App\Config->isSetFlag('web/secure/use_...') #25 /var/www/html/sitespi/vendor/magento/framework/App/Response/HeaderManager.php(41): Magento\Store\Model\HeaderProvider\Hsts->canApply() #26 /var/www/html/sitespi/vendor/magento/framework/Interception/Interceptor.php(123): Magento\Framework\App\Response\HeaderManager->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor))

27 /var/www/html/sitespi/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(26):

Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array) #28 /var/www/html/sitespi/vendor/magento/framework/App/Http.php(185): Magento\Framework\App\Response\Http\Interceptor->sendResponse() #29 /var/www/html/sitespi/vendor/magento/framework/App/Http.php(156): Magento\Framework\App\Http->handleDeveloperMode(Object(Magento\Framework\App\Bootstrap), Object(Zend_Db_Adapter_Exception)) #30 /var/www/html/sitespi/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->catchException(Object(Magento\Framework\App\Bootstrap), Object(Zend_Db_Adapter_Exception)) #31 /var/www/html/sitespi/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))

32 {main} Next Zend_Db_Adapter_Exception: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) in

/var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:144 Stack trace: #0 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 /var/www/html/sitespi/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(353): Zend_Db_Adapter_Pdo_Mysql->_connect() #2 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #3 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT main_ta...', Array) #4 /var/www/html/sitespi/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(465): Zend_Db_Adapter_Pdo_Abstract->query('SELECTmain_ta...', Array) #5 /var/www/html/sitespi/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(520): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `main_ta...', Array) #6 /var/www/html/sitespi/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(737): Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select), Array) #7 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/Db/FetchStrategy/Query.php(21): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select), Array) #8 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(772): Magento\Framework\Data\Collection\Db\FetchStrategy\Query->fetchAll(Object(Magento\Framework\DB\Select), Array) #9 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(668): Magento\Framework\Data\Collection\AbstractDb->_fetchAll(Object(Magento\Framework\DB\Select))

10 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(572):

Magento\Framework\Data\Collection\AbstractDb->getData() #11 /var/www/html/sitespi/vendor/magento/framework/Data/Collection/AbstractDb.php(557): Magento\Framework\Data\Collection\AbstractDb->loadWithFilter(false, false) #12 /var/www/html/sitespi/vendor/magento/framework/Data/Collection.php(820): Magento\Framework\Data\Collection\AbstractDb->load() #13 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(78): Magento\Framework\Data\Collection->getIterator() #14 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(58): Magento\Config\App\Config\Source\RuntimeConfigSource->loadConfig() #15 /var/www/html/sitespi/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Config\App\Config\Source\RuntimeConfigSource->get('') #16 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Type/System/Reader.php(73): Magento\Framework\App\Config\ConfigSourceAggregated->get() #17 /var/www/html/sitespi/var/generation/Magento/Config/App/Config/Type/System/Reader/Proxy.php(95): Magento\Config\App\Config\Type\System\Reader->read() #18 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Type/System.php(212): Magento\Config\App\Config\Type\System\Reader\Proxy->read() #19 /var/www/html/sitespi/vendor/magento/module-config/App/Config/Type/System.php(170): Magento\Config\App\Config\Type\System->loadDefaultScopeData('default')

20 /var/www/html/sitespi/vendor/magento/framework/App/Config.php(139):

Magento\Config\App\Config\Type\System->get('default/web/sec...') #21 /var/www/html/sitespi/vendor/magento/framework/App/Config.php(90): Magento\Framework\App\Config->get('system', 'default/web/sec...') #22 /var/www/html/sitespi/vendor/magento/framework/App/Config.php(103): Magento\Framework\App\Config->getValue('web/secure/use_...', 'default', NULL) #23 /var/www/html/sitespi/vendor/magento/module-store/Model/HeaderProvider/Hsts.php(48): Magento\Framework\App\Config->isSetFlag('web/secure/use_...') #24 /var/www/html/sitespi/vendor/magento/framework/App/Response/HeaderManager.php(41): Magento\Store\Model\HeaderProvider\Hsts->canApply() #25 /var/www/html/sitespi/vendor/magento/framework/Interception/Interceptor.php(123): Magento\Framework\App\Response\HeaderManager->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor))

26 /var/www/html/sitespi/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(26):

Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array) #27 /var/www/html/sitespi/vendor/magento/framework/App/Http.php(185): Magento\Framework\App\Response\Http\Interceptor->sendResponse() #28 /var/www/html/sitespi/vendor/magento/framework/App/Http.php(156): Magento\Framework\App\Http->handleDeveloperMode(Object(Magento\Framework\App\Bootstrap), Object(Zend_Db_Adapter_Exception)) #29 /var/www/html/sitespi/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->catchException(Object(Magento\Framework\App\Bootstrap), Object(Zend_Db_Adapter_Exception)) #30 /var/www/html/sitespi/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))

31 {main}

3

After copy the files, you check to changes database connection at

/var/www/html/sitespi/app/etc/env.php

 'db' => 
  array (
    'table_prefix' => '',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => '[Yourhost]',
        'dbname' => '[DBName]',
        'username' => '[DbUser]',
        'password' => '[DbPassword]',
        'active' => '1',
      ),
    ),
  ),

Then put the proper mysql access at there

After that You should Delete all clear cache by deleting files from

  • /var/www/html/sitespi/var/cache
  • /var/www/html/sitespi/var/page_cache

Also if you have any cache like redis ,memcache then flush it.

Most import, you need to check your database user has enough User privilege for that database.

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.