/usr/bin/mysqlshow: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

I updated some of the features yesterday and now I get this when trying to manage databases:

/usr/bin/mysqlshow: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

Aditionally, the websites I have using Database are showing "Unable to connect to Database"

Do you know what the issue may be?




Howdy -- it sounds like MySQL isn't running.

You may want to restart it, which you can do by running this command:

/etc/init.d/mysql restart

its already running under process id 853... i reatarted it and same issue

What do these commands show:

ls -l /var/run/mysqld/mysqld.sock

grep socket /etc/mysql/my.cnf

the first one shows this: total 4 -rw-rw---- 1 mysql mysql 4 Sep 8 11:41 mysqld.pid srwxrwxrwx 1 mysql mysql 0 Sep 8 11:41 mysqld.sock

the second one shows:

socket = var/run/mysqld/mysqld.sock socket = /var/run/mysqld/mysqld.sock socket = /var/run/mysqld/mysqld.sock

Well that's odd, it looks like what should be a file is actually a directory. Try doing this to correct it:

/etc/init.d/mysql stop
mv /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock.old
/etc/init.d/mysql start

That should move the directory out of the way so that MySQL can properly create it's .sock file.

same issue.. when I stopped mysql the socket file dissapeared as well as the. pid file. then after restarting mysql i had the same issue..

What you're seeing isn't a Virtualmin issue -- it almost sounds like there's a problem with the MySQL init script.

Ubuntu hasn't pushed out a change to MySQL since June though... and we hadn't heard any reports of problems with that.

I'm curious, what do these commands show:

ls -l /etc/init/mysql.conf
ls -l /etc/init.d/mysql
ls -l /etc/default/mysql
mysql -V
dpkg -l mysql-server

here is the output:

ls -l /etc/init/mysql.conf

-rw-r--r-- 1 root root 1108 Feb 19 2012 /etc/init/my sql.conf

ls -l /etc/init.d/mysql

lrwxrwxrwx 1 root root 21 Jun 11 11:21 /etc/init.d/my sql -> /lib/init/upstart-job

ls -l /etc/default/mysql

ls: cannot access /etc/default/mysql: No such file or directory

mysql -V

mysql Ver 14.14 Distrib 5.

dpkg -l mysql-server

desired=Unknown/Install/Remove/Purge/Hold Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend / Err?=(none)/Reinst-required (Status,Err: uppercase=bad) |/ Name Version Description ++-==============-==============-============================================ i mysql-server 5.5.24-0ubuntu MySQL database server (metapackage depending


try this:

ps -aux | grep mysql

then you can view the process pid (columns nr. 2), and run tis:

kill -s SIGKILL pid (etc. kill -s SIGKILL 23456 )

Next step

/etc/init.d/mysql start

I fixed it, it was a matter of adding "/" before "var" in the file "my.cnf" located udner the mysqld folder:

here's the path in Ubuntu /etc/mysql/my.cnf

here's how it looked:

[client] port = 3306 socket = var/run/mysqld/mysqld.sock

I noticed before "var" the "/" was missing so I added it and resterted mysql service and everything worked again as it should.

Here's how it looks now:

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock


Not sure what caused it but was after an apt-get update followed by apt-get upgrade