Missing mysqld.sock file on linux server I have this error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 &quot;No such file or directory&quot;)

Does anyone know what is wrong? It seems it isn't installing mysqld.sock when I run apt-get install mysql-server. I tried find / -name &quot;mysqld.sock&quot; but it can't find anything. How can I get mysqld.sock?
It should not install mysqld.sock. This file is a unix socket, it doesn't refer to a byte stream on your hard disk.

It is more like a TCP port: programs can listen here, and other programs can connect it to communicate with it. The only significant different is that TCP ports are identified by a number between 1 and 65535. Unix sockets are identified by their path, like /var/run/mysql/mysqld.sock.

mysqld.sock is created by the mysql daemon on start, and it is removed (or, becomes un-connectable) if this daemon stops.

This message is given by some client process, trying to connect your mysqld on this socket without success.

Its most likely reason is that the mysqld doesn't run.

Why it doesn't run? Try to start it (systemctl start mysqld) and check the /var/log/mysql* .