Fix Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111)

By | March 22, 2020

If you open your site and get error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111), You can read this tutorial to find a solution.

Why this error occur?

As to us, the reason for this error is there is no space in our vps. We should delete some files and directories.

As to ubuntu system, we can delete files and directories with rm command. Here is a tutorial.

A Beginner Guide to Delete Files and Directories on Ubuntu Using rm Command

How to fix this error?

The first way is to delete some files and directories

Then you can reboot ubuntu. To reboot ubuntu, you can read:

Best Practice to Reboot Ubuntu for Beginners by PuTTY – Ubuntu Tutorial

Then you will find this error may be fixed.  If not, you can restart mysql with command:

/etc/init.d/mysql start

restart mysql on ubuntu example

You can connect mysql successfully.

 

Category: PHP

Leave a Reply