Cloudkul Support

“Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)” error in Docker ?

If you happen to get “Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)” errors in logging in to mysql-server while working on docker containers:

check the path of socket file in /etc/mysql/my.cnf

check if mysqld.sock and mysqld.pid file is present in /var/run/mysqld/ directory or not.

If not, create these files as:

Now restart the mysql-server as:

Now, trying logging again in to mysql-server.

Is this article is helpful?

People like and 0 people dislike.

If result is not found or irrelevant, Please contact us.

Submit your request