当前位置:Gxlcms > mysql > Linux下MySQL-Proxy的安装配置

Linux下MySQL-Proxy的安装配置

时间:2021-07-01 10:21:17 帮助过:49人阅读

MySQL-Proxy的二进制版本的安装相对简单,无需多言,下面介绍的是载Linux下源代码安装:安装pkg-config:tar zxvf pkg-config-0.

MySQL-Proxy的的安装相对简单,无需多言,下面介绍的是载Linux下源代码安装:

安装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-1.4.10-stable.tar.gz

cd libevent-1.4.10-stable

./configure

make

make install

安装glib:

tar zxvf glib-2.20.0.tar.gz

cd glib-2.20.0

./configure

make

make install

安装lua:

tar zxvf lua-5.1.4.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:

这里介绍的是完整安装mysql,其实你只要安装mysql开发包即可。

tar zxvf mysql-5.1.33.tar.gz

cd tar zxvf mysql-5.1.33

./configure

make

make install

cp support-files/mysql.server /etc/init.d/mysql

chown +x /etc/init.d/mysql

cp support-files/my-[small|medium|large|huge|innodb-heavy-4G].cnf /etc/my.cnf

如果my.cnf里有skip-federated选项,就注释它,否则安装数据库的时候会出现类似下面的错误:

[ERROR] /usr/local/libexec/mysqld: unknown option '--skip-federated'

/usr/local/bin/mysql_install_db --user=mysql

/usr/local/bin/mysqld_safe --user=mysql &

保证系统能找到mysql_config,后面编译mysql-proxy会用到它:

export PATH=$PATH:/usr/local/bin

还要保证系统能找到mysql库文件:

vi /etc/ld.so.conf 加入/usr/local/lib目录

执行:/sbin/ldconfig /etc/ld.so.conf

linux

人气教程排行