Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Channel: Linux
Abstract: Check and free some space in root partition and restart MySQL service. # df -hCause 3. Permission issue with /tmp directory Solution
Error: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

This is a common issue faced by MySQL administrators generally. I have also faced this issue many times on various server and almost I fixed this issues using one of below given solutions. We hope following solutions will fix your issue also.

Cause 1: MySQL service stopped

Solution : To fix this issue start mysql daemon.

service mysqld start
Cause 2. Not enough space on / ( root ) partition.

Solution: Check and free some space in root partition and restart MySQL service.

# df -h

Cause 3. Permission issue with /tmp directory

Solution: Assign appropriate permissions to your /tmp directory.

# chmod 1777 /tmp

Ref From: tecadmin
Channels: MySQLerror

Related articles