Ls: cannot access '/var/lib/mysql/mysql.sock': No such file or directory

when ı start mysqld service, ı get error. when ı starting mysqld /mysql.sock not directory.
how can ı resolve?

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

Hi Gungor,

Could you check location of the socket on your installation?

find / -name mysql.sock


Hello @parttime

Places where you can check socket file config depending on MySQL installation method,

  • Configuration file: my.cnf
  • mysqld process: ps -ef | grep -i mysqld
  • find / -name mysql.sock

After getting the socket file path details check if the directory exists, and if it’s, make sure it has correct ownership and file permission.