本文共 1014 字,大约阅读时间需要 3 分钟。
1、下载 并在linux服务器上安装,如果提示缺少libcurl 就先安装curl(命令:yum install curl*)
安装命令: tar zxvf mysql-udf-http-1.0.tar.gz cd mysql-udf-http-1.0/ ./configure --prefix=/usr/local/mysql --with-mysql=/usr/local/mysql/bin/mysql_config make && make install2、正常的情况mysql-udf-http.so等文件将安装至/usr/local/mysql/lib/plugin下,如果路径出现偏差做一个软链
ln -s /usr/local/mysql/lib/mysql-udf-http.so /usr/local/mysql/lib/plugin/mysql-udf-http.so 3、打开Naviat 创建函数 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’;4、写触发器
插入 DELIMITER | DROP TRIGGER IF EXISTS test_insert; CREATE TRIGGER test_insert AFTER INSERT ON test FOR EACH ROW BEGIN SET @tt_re = (SELECT http_get(CONCAT(‘http://192.168.179.125:8090/pos/test?deviceToken=’, NEW.userName))); – SELECT @tt_re; END | DELIMITER ; 更新 5、插入语句 insert into test(userName) values(‘zansan’)完成
转载地址:http://wjnab.baihongyu.com/