栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

mysql8调用HTTP请求

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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/

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/395613.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号