Using Magento 2.3.5p1.
Restored a backup. holiday_dev shows in phpmyadmin with records. This shows instead of site:
2 exception(s): Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [1049] Unknown database 'holiday_dev' Exception #1 (PDOException): SQLSTATE[HY000] [1049] Unknown database 'holiday_dev' Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [1049] Unknown database 'holiday_dev' <pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:410] #2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:861] #3 Zend_Db_Adapter_Abstract->quote() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:1181] #4 Magento\Framework\DB\Adapter\Pdo\Mysql->showTableStatus() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:2618] #5 Magento\Framework\DB\Adapter\Pdo\Mysql->isTableExists() called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:92] #6 Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities() called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:58] #7 Magento\Store\App\Config\Source\RuntimeConfigSource->get() called at [vendor/magento/framework/App/Config/ConfigSourceAggregated.php:40] #8 Magento\Framework\App\Config\ConfigSourceAggregated->get() called at [generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php:95] #9 Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() called at [vendor/magento/module-store/App/Config/Type/Scopes.php:63] #10 Magento\Store\App\Config\Type\Scopes->get() called at [vendor/magento/framework/App/Config.php:132] #11 Magento\Framework\App\Config->get() called at [vendor/magento/module-store/Model/StoreRepository.php:106] #12 Magento\Store\Model\StoreRepository->getById() called at [vendor/magento/module-store/Model/StoreRepository.php:127] #13 Magento\Store\Model\StoreRepository->getActiveStoreById() called at [vendor/magento/module-store/Model/StoreResolver.php:181] #14 Magento\Store\Model\StoreResolver->getDefaultStoreById() called at [vendor/magento/module-store/Model/StoreResolver.php:126] #15 Magento\Store\Model\StoreResolver->getCurrentStoreId() called at [vendor/magento/module-store/Model/StoreManager.php:160] #16 Magento\Store\Model\StoreManager->getStore() called at [generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php:119] #17 Magento\Store\Model\StoreManagerInterface\Proxy->getStore() called at [vendor/magento/module-store/Model/Resolver/Store.php:30] #18 Magento\Store\Model\Resolver\Store->getScope() called at [vendor/magento/framework/App/Config/ScopeCodeResolver.php:49] #19 Magento\Framework\App\Config\ScopeCodeResolver->resolve() called at [vendor/magento/framework/App/Config.php:69] #20 Magento\Framework\App\Config->getValue() called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:123] #21 Magento\Backend\App\Area\FrontNameResolver->isHostBackend() called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:106] #22 Magento\Backend\App\Area\FrontNameResolver->getFrontName() called at [vendor/magento/framework/App/AreaList.php:76] #23 Magento\Framework\App\AreaList->getCodeByFrontName() called at [vendor/magento/framework/App/Http.php:111] #24 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24] #25 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261] #26 Magento\Framework\App\Bootstrap->run() called at [index.php:39] </pre> Exception #1 (PDOException): SQLSTATE[HY000] [1049] Unknown database 'holiday_dev' <pre>#1 Zend_Db_Adapter_Pdo_Abstract->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php:111] #2 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:410] #3 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:861] #4 Zend_Db_Adapter_Abstract->quote() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:1181] #5 Magento\Framework\DB\Adapter\Pdo\Mysql->showTableStatus() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:2618] #6 Magento\Framework\DB\Adapter\Pdo\Mysql->isTableExists() called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:92] #7 Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities() called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:58] #8 Magento\Store\App\Config\Source\RuntimeConfigSource->get() called at [vendor/magento/framework/App/Config/ConfigSourceAggregated.php:40] #9 Magento\Framework\App\Config\ConfigSourceAggregated->get() called at [generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php:95] #10 Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() called at [vendor/magento/module-store/App/Config/Type/Scopes.php:63] #11 Magento\Store\App\Config\Type\Scopes->get() called at [vendor/magento/framework/App/Config.php:132] #12 Magento\Framework\App\Config->get() called at [vendor/magento/module-store/Model/StoreRepository.php:106] #13 Magento\Store\Model\StoreRepository->getById() called at [vendor/magento/module-store/Model/StoreRepository.php:127] #14 Magento\Store\Model\StoreRepository->getActiveStoreById() called at [vendor/magento/module-store/Model/StoreResolver.php:181] #15 Magento\Store\Model\StoreResolver->getDefaultStoreById() called at [vendor/magento/module-store/Model/StoreResolver.php:126] #16 Magento\Store\Model\StoreResolver->getCurrentStoreId() called at [vendor/magento/module-store/Model/StoreManager.php:160] #17 Magento\Store\Model\StoreManager->getStore() called at [generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php:119] #18 Magento\Store\Model\StoreManagerInterface\Proxy->getStore() called at [vendor/magento/module-store/Model/Resolver/Store.php:30] #19 Magento\Store\Model\Resolver\Store->getScope() called at [vendor/magento/framework/App/Config/ScopeCodeResolver.php:49] #20 Magento\Framework\App\Config\ScopeCodeResolver->resolve() called at [vendor/magento/framework/App/Config.php:69] #21 Magento\Framework\App\Config->getValue() called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:123] #22 Magento\Backend\App\Area\FrontNameResolver->isHostBackend() called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:106] #23 Magento\Backend\App\Area\FrontNameResolver->getFrontName() called at [vendor/magento/framework/App/AreaList.php:76] #24 Magento\Framework\App\AreaList->getCodeByFrontName() called at [vendor/magento/framework/App/Http.php:111] #25 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24] #26 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261] #27 Magento\Framework\App\Bootstrap->run() called at [index.php:39] </pre>
Solved! Go to Solution.
On your webserver in the section MySQL databases, and the add user to database.
Check the user credentials in your env.php
Hello,
Is the correct user with access rights added to the restored database in sql?
Thanks for your response.
How do I check or assign correct user to database?
Thank you speerio!
Sheba,
Glad that i could help.
Regards
try checking the user access rights for the database. to check the allowed database you can log in into
mysql -u username -p
SHOW DATABASES;
this will list out the databases for that user.
if you can't see the database "holiday_dev" then check with your root user and assign this database to the user configured in app/etc/env.php
OR update the root user's credentials in env.php