Tuesday, January 15, 2008

compile mysql 5.0.45 under freebsd 6.2

I had mysql4 running on my server, now I wanted to install mysql5 on the same box but also kept mysql4 co-exist. My choice was to compile mysql from source to a custom location. It is to be installed in: /opt/mysql-5.0.45/

After regular compilation and installation, FreeBSD complained about cannot find libmysqlclient_r.
From the INSTALL-SOURCE text file it indicated:
* If your client programs are using threads, you must compile a thread-safe version of the MySQL client library with the `–enable-thread-safe-client’ configure option. This creates a `libmysqlclient_r’ library with which you should link your threaded applications. See *Note threaded-clients::.

So what I was missing was the option
–enable-thread-safe-client

Below is the working config options that I’ve used:
./configure –prefix=/opt/mysql_5.0.45 –with-extra-charsets=complex –with-unix-socket-path=/opt/mysql-5.0.45/tmp/mysql.sock ;
make ; make install

The mysql5 libraries have been installed in:
/opt/mysql-5.0.45/lib/mysql

Now mysql5 libraries has to be added to the shared library path, add the following line to: /etc/ld-elf.so.conf
/opt/mysql-5.0.45/lib/mysql

Reload the ldconfig
/etc/rc.d/ldconfig restart

Remember to create /opt/mysql-5.0.45/my.cnf and change the port number so it doesn’t conflict with the mysql4 instance.
Now mysql5 is ready to be started!

No comments: