[TUTORIAL] How to fix "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'"


  1. Go to https://SERVER_URL:8090/ admin panel link and you see error 500
  2. Try to access webmail and get an Server message: UNAVAILABLE Temporary authentication failure. error
  3. Using email client try to pull email messages and you get a generic error like Cannot connect to server most common with Outlook and BlueMail

Confirm you have this error by running

$ systemctl status mysql || service mysql status


This fix should work 100% of the time on Ubuntu

Open ssh terminal
and run:

$ find / | grep mysqld
## nothing was returned so proceed
$  cd /etc/init.d
$  mysqld start
$  chmod 777 /var/log/mysql/
$  sudo systemctl start mysql

At this moment you should see mysql is running perfectly.


  1. Copying /var/lib/mysql/mysql.sock to /var/run/mysqld/ may fix the issue but the fole might be non-existent
  2. Linking e.g. ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock may fix the issue (the file most certainly will be non-existent )
  3. chown -R mysql:mysql /var/lib/mysql may fix the issue
  4. A simple service mysqld start may fix the issue