Archive for the ‘ubuntu’ Category

Python MySqlDb fixed

Posted: April 13, 2013 in python, ubuntu

still getting error

Error 2002: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

got the answer here:

Changing localhost to solved my problem using MySQLdb


installed xampp on my virtual xubuntu 12.10 box. installation was fine but when trying to access phpMyAdmin got this error

New XAMPP security concept:

Access to the requested object is only available from the local network.

This setting can be configured in the file “httpd-xampp.conf”.

If you think this is a server error, please contact the webmaster.

so I followed this post and did this:

sudo pico /opt/lampp/etc/extra/httpd-xampp.conf

added the “Require all granted” line like in the post.

and restarted xampp:

sudo /opt/lampp/lampp restart


I setup the phpMyAdmin and the MySql and when I tried to connect from python or from mysql-client I got this message:

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

this post has the right fix for xampp. Just run this script and it will work out:

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