title: MySQL suddenly stopped LAMP stack
body: <p>I have been using the LAMP stack on a Ubuntu setup.</p>
  
  <p>It has been working fine, set up multiple databases everything is going fine, and then suddenly this morning I started getting database errors from the webpage I was using, then trying to access PHPMyAdmin got:</p>
  
  <pre><code>error #2002 Cannot log in to the MySQL server
  </code></pre>
  
  <p>I go into the bash prompt and try to log-in as the root user see whats up I get a similar error:</p>
  
  <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) 
  </code></pre>
  
  <p>I checked that the mysql.sock file existed which it does, in the specified path in the error above.  Permissions where all good, and owned by mysql.  I reset the permissions just in case and still get the same error.</p>
  
  <p>Here is the file as seen from BASH:</p>
  
  <pre><code>srwxrwxrwx 1 mysql mysql 0 Oct 21 05:10 mysqld.sock
  </code></pre>
  
  <p>I thought I would just restart the service, but get the same error when trying to stop, start or restart the service.</p>
  
  <p>This really baffled me, I am no expert with linux or anything, but don't understand how this can suddenly happen when I didn't change any of the config settings, and it was running perfectly fine for the last few months.</p>
  
  <p>I tried restarting Apache, and got the error:</p>
  
  <pre><code>apache2: bad user name ${APACHE_RUN_USER}
  </code></pre>
  
  <p>I don't think that is related to the MySQL stuff but thought it could be involved.  The Apache error seems to more be with the set-up but knowing my luck being lazy has caused my to overlook simple things that has caused it all to come crashing down.</p>
  
  <p>Any help on how to fix the problem, and more importantly prevent this occurrence the future would be greatly appreciated.</p>
  
  <p>I have tried most things that were returned by a basic Google search, and a look around here.  I have not yet tried deleting and recreating the sock file, but most other things so far have not worked.</p>
  
  <p>EDIT:</p>
  
  <p>I just wanted to add that the Apache server is still running fine, nothing wrong there even though I do get the error when trying to stop and restart it.  Pages that don't rely on MySQL still load without issue.</p>
  
  <p>I have also tried killing mysql processes through searching the PIDs and also as suggested below killall mysqld (and also killall mysql just for kicks).  No processes found through these attempts.</p>
  
  <p>I don't know if it is relevant or not, but I can't open (in vim) or view the mysqld.sock file (permission denied) even when using the superuser.</p>