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

How to fix it qulickly? ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) | Mysql can’t be started (start job failed to start error) | MySQL -Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

df -h Filesystem Size Used Avail Use% Mounted on udev 493M 12K 493M 1% /dev tmpfs 100M 380K 100M 1% /run /dev/vda1 25G 12G 13G 49% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock tmpfs 497M 0 497M 0% /run/shm none 100M 0 100M 0% /run/user /dev/vda15 105M 3.2M 102M 4% /boot/efi /dev/loop0 497M 8.0K 497M 1% /tmp

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


Have you tried restarting MySQL?

systemctl restart mysql

If you experience the problem even after the restart, I would recommend following the steps listed in this reply here:

Hope that this helps! Regards, Bobby