Just fixed this issue that i was approached for.
This relates to all magento 2 version below 2.4.0.
Everything is working in cli. upgrade, compile and deployment codes are working. Only the frontend is showing 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. Mysqld service is running since its on Mariadb, All the services were running. Checked system.log found out this error “mysql2 not found reverting to mysql service”.
I did a simple query to fixed this frontend issue.
update core_config_data set value = “mysql” where path=”catalog/search/engine”;
Running the above command fixed the issue.
2X Certified Adobe Magento Commerce with 10+ years’ experience in Magento platform