Disclaimer: the problem and the solution are not unique to LAMPP. If you have a MYSQL installation with uncommon paths, you will get a similar problem and you can solve it in a similar way. Just make sure you insert correct paths in the newly created .conf file for the LD (see below).

If, for whatever reason, you are running MySQL from your LAMPP installation and try to use Python’s MySQLdb API to connect to MySQL server you will get the following nasty error into your face:

ImportError: libmysqlclient_r.so.15: cannot open shared object file

The problem is that lampp, in its attemt to not disturb the rest of the OS space, does not expose some crucial shared libraries (like: mysql client, ssl etc.) to Linux at large and Python is unable to find them even though they are installed under LAMPP.

The solution is quite easy

(NO! Do NOT use LD_LIBRARY_PATH, that’s evil). We need to tell LD to look for additional libraries.

For that, we need to create a lampp.conf file under /etc/ld.so.conf.d/ and insert following two lines in it:

/opt/lampp/lib/mysql
/opt/lampp/lib

When that’s done, we tell LD to reload config by issuing:

sudo /sbin/ldconfig

Voila!