SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)



Support for non standard port or unix socket will be available in next release.

Meanwhile you can replace these 2 files:
Mysql.php: lib/Varien/Db/Adapter/Pdo/Mysql.php
Mysqli.php: lib/Varien/Db/Adapter/Mysqli.php

Specify non-standard port like this:


For unix socket use only the path in DB host field during install:


You can also try changing the driver Magento will access mysql in app/etc/config.xml:


There are driver types under <core_setup> (used during install/upgrade) and <core_write> (used during normal operation). Possible values are mysqli and pdo_mysql


File Attachments
Mysql.php  (File Size: 5KB – Downloads: 907)
Mysqli.php  (File Size: 5KB – Downloads: 569)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s