在Centos 5.4上安装社区版Mysql5.1.41(二)
ocal/mysql/lib/mysql;exportLD_LIBRARY_PATH
shell>unset LANG
shell>tar xzvf DBD-mysql-4.013.tar.gz
shell>cd DBD-mysql-4.013
shell>perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config--testuser=root --testpassword= --testhost=localhost--testdb=mysql
shell>make
shell>make test
shell>make install
测试mysqlhotcopy:
shell>mysqlhotcopy -h localhost -u root -p test/tmp
当出现以下类似结果时,表示mysqlhotcopy可以正常使用:
'test' is an empty database
No tables to hot-copy at /usr/local/mysql/bin/mysqlhotcopy line380.
或者:
Locked 1 tables in 0 seconds.
Flushed tables (`test`.`test`) in 0 seconds.
Copying 3 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 1 tables (3 files) in 0 seconds (0 secondsoverall).
4.4. 安装mysql UDF(可选)
由于系统需要,需要能在mysql中调用外部命令,通过安装以下mysql模块就可以实现。
下载源代码:
http://www.mysqludf.org/lib_mysqludf_sys/lib_mysqludf_sys_0.0.3.tar.gz
shell>tar -zxvflib_mysqludf_sys_0.0.3.tar.gz
shell>vim Makefile
注:修改Makefile中gcc参数
原参数为:gcc -Wall -I/usr/include/mysql-I. -shared lib_mysqludf_sys.c -o $(LIBDIR)/lib_mysqludf_sys.so
修改为:gcc -Wall -I/usr/local/mysql/include/mysql-I. -shared lib_mysqludf_sys.c -o /usr/local/mysql/lib/mysql/plugin/lib_mysqludf_sys.so-fPIC
shell>./install.sh
注:编译完成后会连接mysql
数据库,建立mysql函数。脚本会提示输入mysql的root用户密码。
测试mysqlUDF
mysql> select sys_eva l("echohelloworld");
返回以下结果表示UDF建立成功。
+-----------------------------+
| sys_eva l("echohelloworld") |
+-----------------------------+
| helloworld
|
+-----------------------------+
1 row in set (0.05 sec)