I have installed Magento 1.9 but when I am trying to run indexer command I am getting following errors.

PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory in /opt/lampp/htdocs/magento1/lib/Zend/Db/Adapter/Pdo/Abstract.php:128
Stack trace:
#0 /opt/lampp/htdocs/magento1/lib/Zend/Db/Adapter/Pdo/Abstract.php(128): PDO->__construct('mysql:host=loca...', 'mag1', 'mag1@123', Array)
#1 /opt/lampp/htdocs/magento1/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 /opt/lampp/htdocs/magento1/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()
#3 /opt/lampp/htdocs/magento1/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#4 /opt/lampp/htdocs/magento1/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#5 /opt/lampp/htdocs/magento1/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#6 /opt/lampp/htdocs/magento1/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#7 / in /opt/lampp/htdocs/magento1/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 144

I am running

php shell/indexer.php

is it correct or anything else I have to run indexer command Thanks in advance :)

1 Answer 1


You can try to change the server to from localhost

Hope this will work for you.

  • No.i have changed localhost to in my local.xml that didnt worked. Commented Feb 13, 2020 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.