cancel
Showing results for 
Search instead for 
Did you mean: 

Problem only in magento front end Mysql error no such file or directore

Problem only in magento front end Mysql error no such file or directore

Hello all;

I'm using  Magento 2.3.6-p1

In Cli commands everything  works fine.

I can ran setup:upgrade, compilation, content:deploy, etc.

But, when I go to www.mystore.com I get the following:

2 exception(s):
Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [2002] No such file or directory
Exception #1 (PDOException): SQLSTATE[HY000] [2002] No such file or directory

Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [2002] No such file or directory
<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:413]
#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]
#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:238]
#4 Zend_Db_Adapter_Pdo_Abstract->query('SELECT `store_we...', array()) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:549]
#5 Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_we...', array()) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:616]
#6 Magento\Framework\DB\Adapter\Pdo\Mysql->query(&Magento\Framework\DB\Select#000000002d14af8b000000004e3e894d#, array()) called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:737]
#7 Zend_Db_Adapter_Abstract->fetchAll(&Magento\Framework\DB\Select#000000002d14af8b000000004e3e894d#) called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:101]
#8 Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:61]
#9 Magento\Store\App\Config\Source\RuntimeConfigSource->get('') called at [vendor/magento/framework/App/Config/ConfigSourceAggregated.php:40]
#10 Magento\Framework\App\Config\ConfigSourceAggregated->get('') called at [generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php:95]
#11 Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() called at [vendor/magento/module-store/App/Config/Type/Scopes.php:63]
#12 Magento\Store\App\Config\Type\Scopes->get('stores/1') called at [vendor/magento/framework/App/Config.php:132]
#13 Magento\Framework\App\Config->get('scopes', 'stores/1', array()) called at [vendor/magento/module-store/Model/StoreRepository.php:106]
#14 Magento\Store\Model\StoreRepository->getById(1) called at [vendor/magento/module-store/Model/StoreRepository.php:127]
#15 Magento\Store\Model\StoreRepository->getActiveStoreById(1) called at [vendor/magento/module-store/Model/StoreResolver.php:181]
#16 Magento\Store\Model\StoreResolver->getDefaultStoreById(1) called at [vendor/magento/module-store/Model/StoreResolver.php:126]
#17 Magento\Store\Model\StoreResolver->getCurrentStoreId() called at [vendor/magento/module-store/Model/StoreManager.php:160]
#18 Magento\Store\Model\StoreManager->getStore(NULL) called at [generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php:119]
#19 Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) called at [vendor/magento/module-store/Model/Resolver/Store.php:30]
#20 Magento\Store\Model\Resolver\Store->getScope(NULL) called at [vendor/magento/framework/App/Config/ScopeCodeResolver.php:49]
#21 Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL) called at [vendor/magento/framework/App/Config.php:69]
#22 Magento\Framework\App\Config->getValue('admin/url/use_cu...', 'stores') called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:123]
#23 Magento\Backend\App\Area\FrontNameResolver->isHostBackend() called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:106]
#24 Magento\Backend\App\Area\FrontNameResolver->getFrontName(true) called at [vendor/magento/framework/App/AreaList.php:76]
#25 Magento\Framework\App\AreaList->getCodeByFrontName('') called at [vendor/magento/framework/App/Http.php:111]
#26 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#27 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#28 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000002d14afde000000004e3e894d#) called at [index.php:39]
</pre>

Exception #1 (PDOException): SQLSTATE[HY000] [2002] No such file or directory
<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:413]
#3 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]
#4 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:238]
#5 Zend_Db_Adapter_Pdo_Abstract->query('SELECT `store_we...', array()) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:549]
#6 Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_we...', array()) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:616]
#7 Magento\Framework\DB\Adapter\Pdo\Mysql->query(&Magento\Framework\DB\Select#000000002d14af8b000000004e3e894d#, array()) called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:737]
#8 Zend_Db_Adapter_Abstract->fetchAll(&Magento\Framework\DB\Select#000000002d14af8b000000004e3e894d#) called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:101]
#9 Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website', 'code') called at [vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php:61]
#10 Magento\Store\App\Config\Source\RuntimeConfigSource->get('') called at [vendor/magento/framework/App/Config/ConfigSourceAggregated.php:40]
#11 Magento\Framework\App\Config\ConfigSourceAggregated->get('') called at [generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php:95]
#12 Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() called at [vendor/magento/module-store/App/Config/Type/Scopes.php:63]
#13 Magento\Store\App\Config\Type\Scopes->get('stores/1') called at [vendor/magento/framework/App/Config.php:132]
#14 Magento\Framework\App\Config->get('scopes', 'stores/1', array()) called at [vendor/magento/module-store/Model/StoreRepository.php:106]
#15 Magento\Store\Model\StoreRepository->getById(1) called at [vendor/magento/module-store/Model/StoreRepository.php:127]
#16 Magento\Store\Model\StoreRepository->getActiveStoreById(1) called at [vendor/magento/module-store/Model/StoreResolver.php:181]
#17 Magento\Store\Model\StoreResolver->getDefaultStoreById(1) called at [vendor/magento/module-store/Model/StoreResolver.php:126]
#18 Magento\Store\Model\StoreResolver->getCurrentStoreId() called at [vendor/magento/module-store/Model/StoreManager.php:160]
#19 Magento\Store\Model\StoreManager->getStore(NULL) called at [generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php:119]
#20 Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) called at [vendor/magento/module-store/Model/Resolver/Store.php:30]
#21 Magento\Store\Model\Resolver\Store->getScope(NULL) called at [vendor/magento/framework/App/Config/ScopeCodeResolver.php:49]
#22 Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL) called at [vendor/magento/framework/App/Config.php:69]
#23 Magento\Framework\App\Config->getValue('admin/url/use_cu...', 'stores') called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:123]
#24 Magento\Backend\App\Area\FrontNameResolver->isHostBackend() called at [vendor/magento/module-backend/App/Area/FrontNameResolver.php:106]
#25 Magento\Backend\App\Area\FrontNameResolver->getFrontName(true) called at [vendor/magento/framework/App/AreaList.php:76]
#26 Magento\Framework\App\AreaList->getCodeByFrontName('') called at [vendor/magento/framework/App/Http.php:111]
#27 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#28 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#29 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000002d14afde000000004e3e894d#) called at [index.php:39]
</pre>

I tried everything I found in Google. 



Changed host from "localhohst" to "127.0.0.1" in  /app/etc/env.php,  triple checked mysql credentials, tried to connect to  mysql in commandline, everything works fine, but magento web front  continue giving this error.

Server info:

 

 

cPanel  WHm 94.08, mysql maria DB 10.3, php 7.3.27

Thank you for any help;

2 REPLIES 2

Re: Problem only in magento front end Mysql error no such file or directore

@jonas_marques ,

seems like something is missing from configurations 

can you apply the following : 

 

point website's document root to pub folder.

& run the following commands: 

 

rm -rf var/cache/ var/page_cache/ var/view_preprocessed/ generated/code
chmod -R 777  var/ generated

if the issue still not resolved then try with the LUMA theme. 

 

kindly Accept as a Solution if this works for you and give Kudos Smiley Happy 

Re: Problem only in magento front end Mysql error no such file or directore

Hello;

First, thank you for your reply.

I tried your sugestion, but nothing was changed.

Any ideas?