I use the LAMP stack in configuring Ubuntu.
It works fine, sets up several databases, everything goes well, and then all of a sudden this morning I started getting database errors from the web page I used, and then tried to access PHPMyAdmin:
error
I enter the bash prompt and try to log in as the root user sees that I am getting a similar error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
I checked that there is a mysql.sock file that it does, at the specified path in the above error. Permissions where all is well and belongs to mysql. I reset permissions just in case and still get the same error.
Here is the file as seen from BASH:
srwxrwxrwx 1 mysql mysql 0 Oct 21 05:10 mysqld.sock
I thought I would just restart the service, but I get the same error when trying to stop, start, or restart the service.
It really baffled me, I am not an expert on Linux or something like that, but I donโt understand how it can happen suddenly when I didnโt change any configuration settings and it worked perfectly for the past few months.
I tried restarting Apache and got an error:
apache2: bad user name ${APACHE_RUN_USER}
I do not think this is due to MySQL stuff, but thought it might be related. The Apache bug seems to be more related to customization, but, knowing that my luck was lazy, made me ignore the simple things that made it all crash.
Any help to fix the problem and, more importantly, prevent this event will be very grateful for the future.
I tried most of the things that were returned by a basic Google search, and have a look here. I have not tried to delete and recreate the socks file yet, but most of the other things still havenโt worked.
EDIT:
I just wanted to add that the Apache server is still working fine, there is nothing wrong with it, although I get an error when I try to stop and restart it. Pages that do not rely on MySQL still load without problems.
I also tried to kill mysql processes by searching for PID, and also, as suggested below, killall mysqld (as well as killall mysql only for hits). No processes were detected as a result of these attempts.
I donโt know if this is relevant or not, but I cannot open (in vim) or view the mysqld.sock file (permission denied) even when using superuser.