Setup :
- Ubuntu 7.04
- installed Xampp 4 linux manually using the steps provided at that page. Default credentials is root without a password
- Installed Mysql Browser by selecting it in the easy to use software install tool. Application > Add/Remove > Programming (make sure you have selected 'All Open Source Applications' in top right selection box)
Problem:
- Started xampp through a shortcut 'gksu /opt/lampp/lampp restart'
- Started Mysql Browser through Application > Programming > Mysql browser
- Create a new connection
- Create a new connection
- Server : localhost
- Port : 3306
- Username : root
- Password :
- Default schema :
- Press Connect
- Get an error like
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)
Solution:
For a standard Xampp installation the socket file is NOT located at /var/run/ ... but inside the /opt/lampp installation.
- open /opt/lamp/etc/my.cnf and read that the socket is located at /opt/lampp/var/mysql/mysql.sock
- In the connection box of mysql browser click the "Details" button and fill in the above value in the 'Connect using Socket file' box
- Press Connect again.
- You're connected !!

Comments
Hello I have installed xampp
Sun, 2008-11-16 20:49 — elena (not verified)Hello
I have installed xampp and I need to connect to mysql with the prompt. Please I don't know which commands I have to write.
Please do you know the commands??
thanks you
For the use with other
Fri, 2008-04-11 13:37 — Michael (not verified)For the use with other Applications, which can't be configured by a 'Connect using Socket file' box you could create a symbolic soft link in the expected directory, like '/var/run/mysqld/mysql.sock' which refers to '/opt/lampp/var/mysql/mysql.sock'.
cd /var/run
mkdir mysqld
sudo ln -s /opt/lampp/var/mysql/mysql.sock mysqld.sock
This works for me, when trying to connect amarok to mysql.
Thanks for that tip.. It's
Mon, 2008-04-14 11:22 — Roel De MeesterThanks for that tip.. It's always nice when you can use symbolic links to fool linux ;)
HEY! thanks for this very
Tue, 2007-11-20 03:27 — Ryan (not verified)HEY! thanks for this very helpful instructions ! saved me from reinstalling mysql !