MySQL Proxy 編譯安裝 By CentOS

MySQL Proxy Download:
MySQL Proxy Wiki:

1、lua 安装
Get lua from:

1. vi Makefile (将 "INSTALL_TOP= /usr/local" 变为 "INSTALL_TOP= /yourpath/lua")
2. make ansi
3. make install

2、GLib 安装
Get GLib from:

1. ./configure --prefix=/yourpath/glib2
2. make
3. make install

Note: newer version need newer pkg-conifg 0.xx
Get pkg-config from:

1. ./configure
2. make
3. make install

3、libevent 安装
Get libevent from:

1. ./configure --prefix=/yourpath/libevent
2. make;make install

4、check 安装
Get check lib from:

1. ./configure --prefix=/yourpath/check
2. make
3. make install

5、MySQL Proxy 安装
编译前先要设置一下环境变量(export),类似于 Windows 下的 PATH

1. export LUA_CFLAGS="-I/yourpath/lua/include" LUA_LIBS="-L/yourpath/lua/lib -llua -ldl" LDFLAGS="-lm"
3. export GLIB_CFLAGS="-I/yourpath/glib2/include/glib-2.0 -I/yourpath/glib2/lib/glib-2.0/include"
4. export GLIB_LIBS="-L/yourpath/glib2/lib -lglib-2.0"
6. export CPPFLAGS="$CPPFLAGS -I/yourpath/libevent/include"
7. export CFLAGS="$CFLAGS -I/yourpath/libevent/include"
8. export LDFLAGS="$LDFLAGS -L/yourpath/libevent/lib -lm"
10. ./configure --prefix=/yourpath/mysql-proxy --with-mysql=/yourpath/mysql --with-check=/yourpath/check
11. make
12. make install

测试是否安装成功,看下边这条语句是否可以正常输出 MySQL Proxy 的幫助

1. /yourpath/mysql-proxy/sbin/mysql-proxy --help-all

Database error: [Table 'ac_search_cache' is marked as crashed and should be repaired]

SELECT * FROM ac_search_cache WHERE hash = '264ab81641a74898f2d82680a6048123c4e17048' LIMIT 1;