您的位置:首页 > 其它

Msyql-proxy的编译安装

2010-05-17 15:54 309 查看
p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; font-size: 10.5pt; font-family: "Times New Roman" }
a:link,span.MsoHyperlink { color: blue; text-decoration: underline }
a:visited,span.MsoHyperlinkFollowed { color: purple; text-decoration: underline }
div.Section1 { }

Msyql-proxy的编译安装

系统环境

操作系统:Centos
5.4

下载软件包:

wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
wget http://monkey.org/~provos/libevent--stable.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-.tar.gz
wget http://www.lua.org/ftp/lua-.tar.gz
wget http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-Proxy/mysql-proxy-0.7.1.tar.gz

yum install libtermcap-devel ncurses-devel
libevent-devel readline-devel

安装pkg-config


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

安装libevent


tar zxvf libevent--stable.tar.gz

cd libevent-1.4.9-stable

./configure

make

make install

安装glib

tar zxvf glib-.tar.gz

cd glib-2.18.4

./configure

make

make install

安装lua

tar zxvf lua-.tar.gz

cd lua-5.1.4

如果你的服务器是64位的,这时要调整一下Makefile:vi src/Makefile,在CFLAGS里加上-fPIC ,否则会出错:

/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

安装mysql-proxy


tar zxvf mysql-proxy-.tar.gz

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: