centos6.5安裝mysql-udf-http日記

來源:互聯網
上載者:User

標籤:

因為項目需要,資料庫表更新後要即時推送訊息給使用者,想到用mysql-udf-http外掛程式來給mysql提供http請求。

開始安裝:

按照http://zyan.cc/mysql-udf-http/2/1/的方法安裝,

執行到

./configure --prefix=/usr/local/webserver/mysql --with-mysql=/usr/local/webserver/mysql/bin/mysql_config

的時候發現原生mysql不是統一的目錄(當前mysql是rpm的方式安裝),目錄比較亂,安裝不成功。好吧,重裝一個編譯方式安裝的mysql。

編譯方式安裝mysql:

按照http://www.cnblogs.com/xiongpq/p/3384681.html方法安裝。

Mysql安裝路徑為

/usr/local/mysql

繼續安裝mysql-udf-http

tar zxvf curl-7.21.1.tar.gzcd curl-7.21.1/./configure --prefix=/usr

執行到這步的時候報錯:

 No package ‘libcurl‘ foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix. Alternatively, you may set the environment variables DEPS_CFLAGSand DEPS_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.

網上找到解決辦法:

[[email protected] mysql-udf-http-1.0]# whereis pkgconfigpkgconfig: /usr/lib/pkgconfig /usr/lib64/pkgconfig /usr/local/lib/pkgconfig /usr/share/pkgconfig[[email protected] mysql-udf-http-1.0]# export > PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig

繼續安裝

tar zxvf mysql-udf-http-1.0.tar.gzcd mysql-udf-http-1.0/./configure --prefix=/usr/local/webserver/mysql --with-mysql=/usr/local/webserver/mysql/bin/mysql_configmake && make install

到這裡的時候想知道是否安裝成功,到mysql命令執行

create function http_get returns string soname ‘mysql-udf-http.so‘;  create function http_post returns string soname ‘mysql-udf-http.so‘;  create function http_put returns string soname ‘mysql-udf-http.so‘;  create function http_delete returns string soname ‘mysql-udf-http.so‘; 

報錯:找不到mysql-udf-http.so,命令列輸入

find /-name “mysql-udf-http.so” 

也早不到該檔案,看樣子是沒裝成功,回頭看安裝日記,發現錯誤:

gcc: /usr/local/lib/libcurl.so: No such file or directorymake[2]: *** [mysql-udf-http.la] Error 1make[2]: Leaving directory `/usr/local/att/mysql-udf-http-1.0/src‘make[1]: *** [all] Error 2make[1]: Leaving directory `/usr/local/att/mysql-udf-http-1.0/src‘make: *** [all-recursive] Error 1

再看前面

[[email protected] mysql-udf-http-1.0]# export > PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig

懷疑是前面設定的環境變數路徑錯了,改成:

[[email protected] mysql-udf-http-1.0]# whereis pkgconfigpkgconfig: /usr/lib/pkgconfig /usr/lib64/pkgconfig /usr/local/lib/pkgconfig /usr/share/pkgconfig[[email protected] mysql-udf-http-1.0]# export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig

重新執行:

cd mysql-udf-http-1.0/./configure --prefix=/usr/local/webserver/mysql --with-mysql=/usr/local/webserver/mysql/bin/mysql_configmake && make install

這次沒報錯,不過在/usr/local/mysql/lib/plugin目錄下找不到mysql-udf-http.so,而是在/usr/local/mysql/lib目錄下找到mysql-udf-http.so,拷貝到/usr/local/mysql/lib/plugin後,執行

create function http_get returns string soname ‘mysql-udf-http.so‘;  create function http_post returns string soname ‘mysql-udf-http.so‘;  create function http_put returns string soname ‘mysql-udf-http.so‘;  create function http_delete returns string soname ‘mysql-udf-http.so‘;  

添加自訂函數成功。經測試,成功發送請求到web服務。

centos6.5安裝mysql-udf-http日記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.