Submitted by matimont on Sat, 09/08/2012 - 09:10
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?
thanks.
Status:
Active
Comments
Submitted by andreychek on Sat, 09/08/2012 - 10:04 Comment #1
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
Submitted by matimont on Sat, 09/08/2012 - 10:07 Comment #2
its already running under process id 853... i reatarted it and same issue
Submitted by andreychek on Sat, 09/08/2012 - 10:19 Comment #3
What do these commands show:
ls -l /var/run/mysqld/mysqld.sock
grep socket /etc/mysql/my.cnf
Submitted by matimont on Sat, 09/08/2012 - 10:45 Comment #4
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
Submitted by andreychek on Sat, 09/08/2012 - 12:05 Comment #5
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.
Submitted by matimont on Sat, 09/08/2012 - 13:05 Comment #6
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..
Submitted by andreychek on Sat, 09/08/2012 - 14:00 Comment #7
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
Submitted by matimont on Sat, 09/08/2012 - 14:36 Comment #8
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/mysqllrwxrwxrwx 1 root root 21 Jun 11 11:21 /etc/init.d/my sql -> /lib/init/upstart-job
ls -l /etc/default/mysqlls: cannot access /etc/default/mysql: No such file or directory
mysql -Vmysql Ver 14.14 Distrib 5.
dpkg -l mysql-serverdesired=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
Submitted by kallaics on Sat, 09/08/2012 - 15:41 Comment #9
Hy,
try this:
ps -aux | grep mysqlthen 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 startSubmitted by matimont on Mon, 09/10/2012 - 08:46 Comment #10
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
Strange...
Not sure what caused it but was after an apt-get update followed by apt-get upgrade