title: What can cause '/var/lib/mysql/mysql.sock' to get deleted?
body: <p>All of a sudden I started to get this error message on my CentOS WHM Cpanel LAMP stack:</p>
  
  <pre><code>Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  </code></pre>
  
  <p>I restarted the MySQL server via WHM, MySQL started working again however, in just a few seconds/minutes it went down and the above error message returned. This happened several times.</p>
  
  <p>I Googled around for a solution and confirmed that '/var/lib/mysql/mysql.sock' was missing and simply created an empty file '/var/lib/mysql/mysql.sock', restarted the MySQL server via WHM and MySQL started working again and it did not go down this time.</p>
  
  <p>My question is, what could have caused this in the first place?</p>
  
  <p>And shouldn't the initial restart restore any missing /var/lib/mysql/mysql.sock file? Also, why did the restart work and then the error returned?</p>
  
  <p>If the /var/lib/mysql/mysql.sock file was missing, the restart should not have worked until I recreated the /var/lib/mysql/mysql.sock file?</p>
  
  <p>Before the first failure, the server load did peak (but did not peak after).</p>
  
  <p>Also, I got this error:</p>
  
  <pre><code>Access denied for user 'root'@'localhost' (using password: YES)
  </code></pre>
  
  <p>I changed the password via WHM which stopped that error, but then, the sock errors didn't go away.</p>
  
  <p>Any ideas what happened?</p>