mysql mysql-udf-http-1.0 http请求

本文详细介绍了在CentOS Linux release 7.8.2003环境下,如何从源码编译安装libcurl,并进一步安装MySQL UDF HTTP插件,包括解决依赖库问题、配置路径及创建数据库函数的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境

CentOS Linux release 7.8.2003 (Core)

mysql  Ver 15.1 Distrib 5.5.65-MariaDB, for Linux (x86_64) using readline 5.1

ulimit -SHn 65535
wget http://curl.haxx.se/download/curl-7.21.1.tar.gz
tar zxvf curl-7.21.1.tar.gz
cd curl-7.21.1/
./configure --prefix=/usr
make && make install
cd ../

注意:/usr/bin 是自己的mysql 安装目录  如果没有mysql_config文件的话得先安装devel

yum install -y mysql-devel

如果不知道自己的mysql安装目录的话就

which mysql

 还需要安装一些编译的包要不然会碰到下面的问题

yum install -y libstdc++.i686 zlib.i686 glibc.i686 gcc-c++

yum install gcc gcc-c++ autoconf automake

有可能还会遇到下面的问题

configure: error: Package requirements [libcurl >= 7.15.5] were not met: No package 'libcurl' found

首先使用 yum search libcurl 查找 libcurl 库

需要下载一下工具包

 yum install -y libcurl-devel.x86_64

echo "/usr/local/webserver/mysql/lib/mysql/" > /etc/ld.so.conf.d/mysql.conf
/sbin/ldconfig
wget http://mysql-udf-http.googlecode.com/files/mysql-udf-http-1.0.tar.gz
tar zxvf mysql-udf-http-1.0.tar.gz
cd mysql-udf-http-1.0/
./configure --prefix=/usr/bin --with-mysql=/usr/bin/mysql_config
make && make install
cd ../

然后进入数据库

create function http_get returns string soname 'mysql-udf-http.so';  (这个命令可能会出错,因为我形成的.so文件不再对应目录下)

 

上图所示是成功时候的 我的一开始会错误  会报mysql-udf-http.so不再对应目录下 然后你就可以找一下 

find / -name mysql-udf-http.so  找到后创建一个软连接

ln -s /usr/bin/lib/mysql-udf-http.so(这是我找到的位置) /usr/lib64/mysql/plugin/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 UDF函数

drop function http_get;  

drop function http_post;  

drop function http_put;  

drop function http_delete;  

 

本文也借鉴与http://blog.zyan.cc/mysql-udf-http/  但是后来环境问题出现偏差 又搞了好长时间环境

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhl_BeginLife

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值