分类: LINUX
2013-04-17 16:08:03
原文地址:Msyql-proxy的编译安装 作者:飞鸿无痕
Msyql-proxy的编译安装
系统环境
操作系统:Centos 5.4
下载软件包:
wget
wget ~provos/libevent-
wget
wget
wget
yum install libtermcap-devel ncurses-devel libevent-devel readline-devel
安装
:
tar zxvf pkg-config-0.23.tar.gz
cd pkg-config-0.23
./configure
make
make install
确保PKG_CONFIG_PATH环境变量包含了相关的pkg-config配置文件路径:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
安装
:
tar zxvf libevent-
cd libevent-1.4.9-stable
./configure
make
make install
安装 :
tar zxvf glib-
cd glib-2.18.4
./configure
make
make install
安装 :
tar zxvf lua-
cd lua-5.1.4
如果你的服务器是64位的,这时要调整一下Makefile:vi src/Makefile,在CFLAGS里加上 ,否则会出错:
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o):
relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a
shared object;
recompile with –fPIC
/usr/local/lib/liblua.a: could not read
symbols: Bad value
接下来不用执行常见的configure,直接make:
make linux
make install
安装pkg-config配置文件,以便编译mysql-proxy时能找到lua:
cp etc/lua.pc /usr/local/lib/pkgconfig/lua5.1.pc
如果没有执行此步骤的话,在后面编译安装mysql-proxy的时候,会得到类似下面的错误信息:
Package lua5.1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.1' found
安装
:
tar zxvf mysql-proxy-
cd mysql-proxy-0.7.0
./configure
make
make install
搞定了,测试一下:/usr/local/sbin/mysql-proxy –V
启动mysql-proxy
/usr/local/sbin/mysql-proxy --proxy-backend-addresses=192.168.1.103:3306 &
使用proxy访问mysql
Mysql –h192.168.1.103 –P4040 –uzhang -p