mysql8调用HTTP请求

mysql8调用HTTP请求,第1张

mysql8调用HTTP请求

下载mysql-udf-http-1.0.tar.gz

链接:https://pan.baidu.com/s/1PslMSdeqDUE98GnYbG6d8g 
提取码:a740

安装

yum install -y libcurl*
tar -zxvf mysql-udf-http-1.0.tar.gz
cd mysql-udf-http-1.0
vi src/mysql-udf-http.c
//mysql8中没有my_bool数据类型,需要替换成bool
:%s/my_bool/bool/g
//--with-mysql替换成自己mysql安装包的路径
./configure --prefix=/usr/local/mysql-udf-http --with-mysql=/usr/local/mysql/bin/mysql_config
make && make install
//创建软连接
ln -s /usr/local/mysql-udf-http/lib/mysql/plugin/mysql-udf-http.so.0.0.0 /usr/local/mysql/lib/plugin/mysql-udf-http.so

创建函数

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';

发送请求

select CAST(http_get('http://www.baidu.com') AS CHAR CHARACTER SET utf8) as result

其他 *** 作见作者博客

http://zyan.cc/mysql-udf-http/

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4992532.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-14
下一篇 2022-11-14

发表评论

登录后才能评论

评论列表(0条)

保存