MySQL in a custom dir on Linux
If you have installed MySQL server in the standard directory /usr/local/mysql, do not read this post. Else, you may want to know
how to use MySQL shared libraries on your Linux system
For organization purposes, I have installed MySQL in /home dir (which is a separate partition), precisely in /home/server/mysql. Thus, I keep mysql/var, directory (which contains databases) safe from heavy system changes.
My system did not recognized the shared library libmysqlclient, that is under /home/server/mysql/lib/mysql.
How do you tell Linux “Hey, you will find the library here, go and use it”?
Just edit the file /etc/ld.so.conf and add the path to your library. Then, reboot or give this command:
to register new libraries.
Compiling programs that require MySQL components
Another issue you’ll have to deal with when your MySQL is installed in a non-standard path, is the source compilation and use of programs that require some MySQL components.
For example, I use a C program that has this header on its source:
I got errors related to paths when compiling this source.
The solution is not changing the source in order to make #include lines match real paths, but consists in telling the compiler where mysql directory is. Compile with such a command line (or change your Makefile accordingly):







