Connect MySQL through Socket

Reprint from Edmonds Commerce:

Ubuntu Xampp MySQL Administrator

If you are using XAMPP on Ubuntu (or probably other) Linux and are also trying to use the MySQL Administrator and MySQL Query Browser GUI tools available in the repo’s, you have probably hit an error message like this:

Could not connect to host ‘localhost’.

MySQL Error Nr. 2002

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

A nice quick fix for this one. In the terminal run the following two commands and then you should be able to connect fine using localhost as the host and the configured MySQL username and password.

sudo mkdir /var/run/mysqld/

sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock