Mysql創建nextval函數


1,

mysql 創建函數出錯信息如下:

Error Code: 1227. Access denied; you need (at least one of) the SUPER privilege(s) for this operation

首先檢查創建函數的功能是否開啟,檢查是否開啟創建功能的SQL如下:

-- 查看是否開啟創建函數的功能
show variables like '%func%';
-- 開啟創建函數的功能
set global log_bin_trust_function_creators = 1;

執行完SQL之后發現已經開啟了,隨檢查自己的SQL是否寫錯

 

2,

DROP FUNCTION IF EXISTS `nextval`;
delimiter ;;
CREATE DEFINER=`root`@`127.0.0.1` FUNCTION `nextval`(n varchar(50)) RETURNS int(11)
begin
declare _cur int;
set _cur=(select current_value from tb_sequence where name= n);
update tb_sequence
set current_value = _cur + _increment
where name=n ;
return _cur;
end
;;
delimiter ;
 
3,圖片創建


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM