1

I have migrated all the files from my local server to my production server, I have copied the database, I have changed the database connection data in the file /app/etc/env.php with the new URL and I have cleaned cache. In the error shown below, you can see in bold that you are using the password of the database user that you had in the local environment, but I have changed it in the configuration file. How can this be?

env.php

'db' => [
    'table_prefix' => '',
    'connection' => [
        'default' => [
            'host' => 'http://xxx.xxx.xxx.xxx',
            'dbname' => 'magentodb',
            'username' => 'magentoUser',
            'password' => 'Password.19#test$/',
            'model' => 'mysql4',
            'engine' => 'innodb',
            'initStatements' => 'SET NAMES utf8;',
            'active' => '1'
        ]
    ]
],

Error

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'magentoUser'@'localhost' (using password: YES) in /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128 Stack trace: #0 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct('mysql:host=loca...', 'magentoUser', 'Password2019', Array) #1 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(406): Zend_Db_Adapter_Pdo_Mysql->_connect() #3 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #4 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT store_w...', Array) #5 /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(541): Zend_Db_Adapter_Pdo_Abstract->query('SELECTstore_w...', Array) #6 /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(615): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_w...', Array) #7 /var/www/magento/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/magento/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(87): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select))

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

Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') #10 /var/www/magento/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Store\App\Config\Source\RuntimeConfigSource->get('') #11 /var/www/magento/generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php(95): Magento\Framework\App\Config\ConfigSourceAggregated->get('') #12 /var/www/magento/vendor/magento/module-store/App/Config/Type/Scopes.php(63): Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() #13 /var/www/magento/vendor/magento/framework/App/Config.php(131): Magento\Store\App\Config\Type\Scopes->get('stores/1') #14 /var/www/magento/vendor/magento/module-store/Model/StoreRepository.php(106): Magento\Framework\App\Config->get('scopes', 'stores/1', Array) #15 /var/www/magento/vendor/magento/module-store/Model/StoreRepository.php(127): Magento\Store\Model\StoreRepository->getById('1') #16 /var/www/magento/vendor/magento/module-store/Model/StoreResolver.php(181): Magento\Store\Model\StoreRepository->getActiveStoreById('1') #17 /var/www/magento/vendor/magento/module-store/Model/StoreResolver.php(126): Magento\Store\Model\StoreResolver->getDefaultStoreById('1') #18 /var/www/magento/app/code/Rokanthemes/RokanBase/Model/Rewrite/Store/StoreManager.php(12): Magento\Store\Model\StoreResolver->getCurrentStoreId() #19 /var/www/magento/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119): Rokanthemes\RokanBase\Model\Rewrite\Store\StoreManager->getStore(NULL)

20 /var/www/magento/vendor/magento/module-store/Model/Resolver/Store.php(30):

Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) #21 /var/www/magento/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL) #22 /var/www/magento/vendor/magento/framework/App/Config.php(69): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL) #23 /var/www/magento/vendor/magento/module-developer/Model/Logger/Handler/Debug.php(63): Magento\Framework\App\Config->getValue('dev/debug/debug...', 'stores')

24 /var/www/magento/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(31):

Magento\Developer\Model\Logger\Handler\Debug->isHandling(Array) #25 /var/www/magento/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array) #26 /var/www/magento/vendor/magento/framework/Logger/Monolog.php(48): Monolog\Logger->addRecord(400, 'SQLSTATE[HY000]...', Array) #27 /var/www/magento/vendor/monolog/monolog/src/Monolog/Logger.php(707): Magento\Framework\Logger\Monolog->addRecord(400, 'SQLSTATE[HY000]...', Array) #28 /var/www/magento/vendor/magento/framework/App/Bootstrap.php(263): Monolog\Logger->error('SQLSTATE[HY000]...') #29 /var/www/magento/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

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

in /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:144 Stack trace: #0 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(406): Zend_Db_Adapter_Pdo_Mysql->_connect() #2 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #3 /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT store_w...', Array) #4 /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(541): Zend_Db_Adapter_Pdo_Abstract->query('SELECTstore_w...', Array) #5 /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(615): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_w...', Array) #6 /var/www/magento/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/magento/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(87): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select))

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

Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') #9 /var/www/magento/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Store\App\Config\Source\RuntimeConfigSource->get('') #10 /var/www/magento/generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php(95): Magento\Framework\App\Config\ConfigSourceAggregated->get('') #11 /var/www/magento/vendor/magento/module-store/App/Config/Type/Scopes.php(63): Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() #12 /var/www/magento/vendor/magento/framework/App/Config.php(131): Magento\Store\App\Config\Type\Scopes->get('stores/1') #13 /var/www/magento/vendor/magento/module-store/Model/StoreRepository.php(106): Magento\Framework\App\Config->get('scopes', 'stores/1', Array) #14 /var/www/magento/vendor/magento/module-store/Model/StoreRepository.php(127): Magento\Store\Model\StoreRepository->getById('1') #15 /var/www/magento/vendor/magento/module-store/Model/StoreResolver.php(181): Magento\Store\Model\StoreRepository->getActiveStoreById('1') #16 /var/www/magento/vendor/magento/module-store/Model/StoreResolver.php(126): Magento\Store\Model\StoreResolver->getDefaultStoreById('1') #17 /var/www/magento/app/code/Rokanthemes/RokanBase/Model/Rewrite/Store/StoreManager.php(12): Magento\Store\Model\StoreResolver->getCurrentStoreId() #18 /var/www/magento/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119): Rokanthemes\RokanBase\Model\Rewrite\Store\StoreManager->getStore(NULL)

19 /var/www/magento/vendor/magento/module-store/Model/Resolver/Store.php(30):

Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) #20 /var/www/magento/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL) #21 /var/www/magento/vendor/magento/framework/App/Config.php(69): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL) #22 /var/www/magento/vendor/magento/module-developer/Model/Logger/Handler/Debug.php(63): Magento\Framework\App\Config->getValue('dev/debug/debug...', 'stores')

23 /var/www/magento/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(31):

Magento\Developer\Model\Logger\Handler\Debug->isHandling(Array) #24 /var/www/magento/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array) #25 /var/www/magento/vendor/magento/framework/Logger/Monolog.php(48): Monolog\Logger->addRecord(400, 'SQLSTATE[HY000]...', Array) #26 /var/www/magento/vendor/monolog/monolog/src/Monolog/Logger.php(707): Magento\Framework\Logger\Monolog->addRecord(400, 'SQLSTATE[HY000]...', Array) #27 /var/www/magento/vendor/magento/framework/App/Bootstrap.php(263): Monolog\Logger->error('SQLSTATE[HY000]...') #28 /var/www/magento/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

29 {main}

  • Try using an IP for your host instead of localhost – fmsthird Apr 1 at 2:01
  • 1
    can you try renaming your env file to env.php.bk , then run your website setup wizard check if it will work – fmsthird Apr 1 at 6:22
  • 1
    make a backup of your database and try the one I recommend, the one with renaming your env.php file – fmsthird Apr 1 at 6:37
  • 1
    and running wizard again – fmsthird Apr 1 at 6:37
  • 1
    if there are missing products data or customer information or orders try to dump your database from local but if not, it's fine no need to dump :) – fmsthird Apr 1 at 6:47

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.