Today I had to install MySQL Proxy on one of our servers.

What I found was that the current stable version 0.7.2 requires more resent version of Glib2 then what comes with CentOS 5.4.

So here is what I did in order to build it with a different version of glib2 then the default installation:

LUA: download & install from source

  • Required packages: readline readline-devel
  • yum install readline readline-devel

MySQL proxy requires:

  • lua
  • glib2 > 2.16
  • libevent
  • libevent-devel
  • yum install libevent libevent-devel

Build glib:
./configure --prefix=/usr/local/glib2 --disable-selinux --disable-fam --enable-threads --enable-gc-friendly

Build mysql-proxy:

export GLIB_DIR='/usr/local/glib2'
export GLIB_CFLAGS="-I$GLIB_DIR/include/glib-2.0 -I$GLIB_DIR/lib/glib-2.0/include/"
export GMODULE_CFLAGS="-I$GLIB_DIR/include/glib-2.0 -I$GLIB_DIR/lib/glib-2.0/include/"
export GTHREAD_CFLAGS="-pthread -I$GLIB_DIR/include/glib-2.0 -I$GLIB_DIR/lib/glib-2.0/include/"
export GLIB_LIBS="-L$GLIB_DIR/lib -lglib-2.0"
export GMODULE_LIBS="-Wl,--export-dynamic -L$GLIB_DIR/lib -lgmodule-2.0 -ldl -lglib-2.0"
export GTHREAD_LIBS="-pthread -L$GLIB_DIR/lib -lgthread-2.0 -lglib-2.0"
./configure --prefix=/usr/local/mysql-proxy --with-lua
make -j4
make install


One Response to “MySQL Proxy on CentOS 5.4”

  1. admin Says:

    If you want to use more recent version of libevent, you should remove libevent & libevent-devel:
    # yum remove libevent libevent-devel

    Install libevent at some location, for example /usr/local/libevent.

    Then add this to the list of exports before running configure into mysql-proxy source directory:

    export CPPFLAGS='-I/usr/local/libevent/include/'
    export LDFLAGS='-L/usr/local/libevent/lib/'

Posted by HackMan
Dated: 26th November 2009
Filled Under: Linux General, Technology