Question

Unable to connect MySQL server 5.7.22...

Posted July 6, 2018 848 views
MySQL Ubuntu 16.04

I work on cloud Ubuntu 16.04 and configure Asterisk server from scratch, but unable to resolve MySQL server to connect to local host i tried different solutions but unable to resolve issue

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

change my.cnf files reconfigure it again but still got an error…

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.

1 answer

Hello,

That error means the file /var/run/mysqld/mysqld.sock doesn’t exists, if you didn’t install mysql-server, then the file would not exist. But if the mysql-server is already installed and is running, then you need to check the config files.

The config files are:

/etc/my.cnf
/etc/mysql/my.cnf
/var/lib/mysql/my.cnf

In /etc/my.cnf, the socket file config may be /tmp/mysql.sock and in /etc/mysql/my.cnf the socket file config may be /var/run/mysqld/mysqld.sock. So, remove or rename /etc/mysql/my.cnf, let mysql use /etc/my.cnf, then the problem may solved.

Hope this helps!

Alex

Submit an Answer