直接看作者 文檔
mysql-udf-http作者的項目說明: http://blog.zyan.cc/mysql-udf-http/
Google訪問不了敏簿,可以搜索其他下載地址
注意點1
echo "/usr/local/webserver/mysql/lib/mysql/" > /etc/ld.so.conf.d/mysql.conf
通常這個應(yīng)該是這樣,lib/后面不需要其他內(nèi)容:
echo "/usr/local/mysql/lib/" > /etc/ld.so.conf.d/mysql.conf
注意點2
在執(zhí)行./configure --prefix=/usr/local/mysql --with-mysql=/usr/local/mysql/bin/mysql_config 時候
checking for DEPS... configure: error: Package requirements (libcurl >= 7.15) were not met:
No package 'libcurl' found
這個找不到libcurl,文檔第一步就是安裝curl,如果安裝失敗宣虾,檢查原因重新安裝惯裕。如果成功了,可以自己手動找一下
[root@localhost mysql-udf-http-1.0]# which curl
/usr/bin/curl
[root@localhost mysql-udf-http-1.0]# find / -name libcurl.pc
/home/mysql/curl-7.21.1/libcurl.pc
/usr/lib/pkgconfig/libcurl.pc
[root@localhost mysql-udf-http-1.0]# cp /usr/lib/pkgconfig/libcurl.pc /usr/lib64/pkgconfig/
這里系統(tǒng)lib里面有這個文件绣硝,因為是64位系統(tǒng)蜻势,所以位置不對。cp過去就行了鹉胖。
注意點3
在執(zhí)行make && make install安裝mysql-udf-http-1.0時報錯:
cd mysql-udf-http-1.0/
./configure --prefix=/usr/local/webserver/mysql --with-mysql=/usr/local/webserver/mysql/bin/mysql_config
make && make install
錯誤如下:
ERROR 1126 (HY000): Can't open shared library 'mysql-udf-http.so' (errno: 2 /usr/local/mysql/lib/plugin/mysql-udf-http.so: cannot open shared object file: No such file or directory)
原因是找不到這個文件握玛,errno: 2 /usr/local/mysql/lib/plugin/mysql-udf-http.so: cannot open shared object file: No such file or directory,
[root@localhost mysql-udf-http-1.0]# find / -name mysql-udf-http.so
/home/mysql/mysql-udf-http-1.0/src/.libs/mysql-udf-http.so
/usr/local/mysql/lib/mysql-udf-http.so
文件沒有在plugin目錄甫菠,而是在plugin的上級目錄里挠铲。
[root@localhost mysql-udf-http-1.0]# ls /usr/local/mysql/lib/
libmysqlclient.a libmysqlclient.so mysql-udf-http.la
libmysqlclient_r.a libmysqlclient.so.18 mysql-udf-http.so
libmysqlclient_r.so libmysqlclient.so.18.1.0 mysql-udf-http.so.0
libmysqlclient_r.so.18 libmysqlservices.a mysql-udf-http.so.0.0.0
libmysqlclient_r.so.18.1.0 mysql-udf-http.a plugin
[root@localhost mysql-udf-http-1.0]# cp /usr/local/mysql/lib/mysql-udf-* /usr/local/mysql/lib/plugin/
[root@localhost mysql-udf-http-1.0]# ls /usr/local/mysql/lib/plugin/ adt_null.so mypluglib.so qa_auth_client.so
auth.so mysql_no_login.so qa_auth_interface.so
auth_socket.so mysql-udf-http.a qa_auth_server.so
auth_test_plugin.so mysql-udf-http.la test_udf_services.so
daemon_example.ini mysql-udf-http.so validate_password.so
debug mysql-udf-http.so.0
libdaemon_example.so mysql-udf-http.so.0.0.0
最后成功安裝后是這樣:
[root@localhost mysql-udf-http-1.0]# mysql -u root -p Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.6.32 Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create function http_get returns string soname 'mysql-udf-http.so';
Query OK, 0 rows affected (0.00 sec)