Saturday, May 7, 2011

Django Installation with XAMPP for Linux-(LAMPP)

I use Ubuntu and XAMPP for my development works. My Xampp location is /opt/lampp.
This post is about Mysql Database connection problem in Django.

First Make sure you've installed the python-mysqldb package.

sudo apt-get install python-mysqldb

Then if you get the following error

_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")'

That means that mysqld can't find you mysql library location. You have to add the library path manually. /etch/ld/so/conf file maintains the extra library locations so add your library here.


sudo gedit /etc/ld.so.conf

Add your mysql library path here. In my case

/opt/lampp/lib/mysql

Now update your config by

sudo ldconfig

And that's it now you can test it by running server


Alternative:

You can also create a .conf file in the /etc/ld.so.conf.d directory and write your location in that file as the ld.co.conf file loads all the files from the directory.

1 comment:

About Me

Web Developer From Dhaka, Bangladesh.