Schogini is Magento2 ready. Are you?

Get started with Magento 2 | Need expert Magento2 support?

Magento Uncaught Exception


Category: Magento 1.9

If you get an error like this in Magento shell prompt:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php:129
Stack trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct('mysql:host=loca...', 'root', '', Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Mysql.php(109): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#3 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#4 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstr in /Applications/XAMPP/xamppfiles/htdocs/magento-19/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 144

Then, it means Zend cannot find the socket for PDO connection. What you need to do is create an alias to your MySQL socket (you may need to login as a root user in terminal to execute these commands)

On XAMPP:

sudo mkdir /var/mysql
cd /var/mysql
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

On MAMP:

sudo mkdir /var/mysql
cd /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock


 

Schogini's customer service extends beyond the natural boundaries. ~ Timothy Johnson

Schogini assures 24x7 - 6 hour turn around ticket response time and 24 hour Email response time (support@schogini.com)