1

My website was working perfectly until yesterday but now it shows an error. I don't know why it is happening. I have deleted cache and session too but it does not work. I am using Magento Ver 1.8.

When I checked the error report, it shows:

a:4:{i:0;s:105:"SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)";i:1;s:2381:"#0 /home/spicefur/public_html/beta/includes/src/__default.php(54845): Zend_Db_Adapter_Pdo_Abstract->_connect()

1 /home/spicefur/public_html/beta/includes/src/__default.php(55325): Zend_Db_Adapter_Pdo_Mysql->_connect()
2 /home/spicefur/public_html/beta/includes/src/__default.php(53532): Varien_Db_Adapter_Pdo_Mysql->_connect()
3 /home/spicefur/public_html/beta/includes/src/__default.php(54588): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
4 /home/spicefur/public_html/beta/includes/src/__default.php(55433): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
5 /home/spicefur/public_html/beta/includes/src/__default.php(29736): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
6 /home/spicefur/public_html/beta/includes/src/__default.php(29677): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
7 /home/spicefur/public_html/beta/includes/src/__default.php(12129): Mage_Core_Model_Resource->getConnection('core_write')
8 /home/spicefur/public_html/beta/includes/src/__default.php(12159): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
9 /home/spicefur/public_html/beta/includes/src/__default.php(12144): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
10 /home/spicefur/public_html/beta/includes/src/Mage_Core_Model_Resource_Cache.php(53): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
11 /home/spicefur/public_html/beta/includes/src/Mage_Core_Model_Cache.php(478): Mage_Core_Model_Resource_Cache->getAllOptions()
12 /home/spicefur/public_html/beta/includes/src/Mage_Core_Model_Cache.php(520): Mage_Core_Model_Cache->_initOptions()
13 /home/spicefur/public_html/beta/includes/src/__default.php(21294): Mage_Core_Model_Cache->canUse('config')
14 /home/spicefur/public_html/beta/includes/src/__default.php(22907): Mage_Core_Model_App->useCache('config')
15 /home/spicefur/public_html/beta/includes/src/__default.php(22787): Mage_Core_Model_Config->_canUseCacheForInit()
16 /home/spicefur/public_html/beta/includes/src/__default.php(20524): Mage_Core_Model_Config->loadModulesCache()
17 /home/spicefur/public_html/beta/includes/src/__default.php(20454): Mage_Core_Model_App->_initModules()
18 /home/spicefur/public_html/beta/app/Mage.php(684): Mage_Core_Model_App->run(Array)
19 /home/spicefur/public_html/beta/index.php(87): Mage::run('', 'store')
20 {main}";s:3:"url";s:6:"/beta/";s:11:"script_name";s:15:"/beta/index.php";} 
halfer
  • 19,824
  • 17
  • 99
  • 186
Udit Gupta
  • 189
  • 1
  • 5
  • 17

2 Answers2

2

The problem is with your MySQL database server, not your magento our web server.

You can try restarting mysql server, might help. If it did, check your mysql server error logs to see why it crashed.

Can't connect to local MySQL server through socket

This question has been asked and answered hundrerds of times. Hopefully one of these can help you...

Community
  • 1
  • 1
Latheesan
  • 23,247
  • 32
  • 107
  • 201
1

Your MySQL server has crashed for some reason so the socket Magento uses to connect to the database is unavailable.

Depending on your setup, you might be able to restart MySQL from your WHM/Cpanel. If MySQL will not restart, you need to look at the error logs and start preparing for dealing with other conditions such as a corrupted database. If you don't have access to the error logs, contact your hosting provider as it's now their problem to deal with.

Also, MySQL being inoperative can be something as simple as your service provider doing maintenance and forgetting to check that MySQL restarted afterwards.

Fiasco Labs
  • 6,457
  • 3
  • 32
  • 43