Mysql建立函式出錯

2022-09-01 16:09:17 字數 1078 閱讀 1876

目前在專案中,執行建立mysql的函式出錯,

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是否寫錯(因為sql是別人給的,在別人環境沒問題,在自己的環境就有可能)。

突然發現了確實是sql出現問題,由於他建立的sql有指定使用者,所以導致出現問題,以下是他的sql:

drop function if exists `nextval`;

delimiter ;;

create definer=`devop`@`%` function `nextval`(`seq_name` varchar(50)) returns varchar(20) charset utf8

begin

declare seq_max bigint(20);

update sequenceconftable set `max` = `max` + next where name = seq_name;

select `max` into seq_max from sequenceconftable where name = seq_name ;

return seq_max;

end;;

delimiter ;

由於create_function規範,可以發現就是definer這個引數是可以指定資料庫使用者的,但是自己的庫卻不是這個使用者,所以導致問題。

目前問題已經解決。

-eof-

析構函式出錯

原文 析構函式報錯 析構函式在什麼時候被呼叫執行?對於c 程式設計師來說,這個問題比較簡單,但是比較愛嘮叨的阿愚還是建議應該在此再提一提,也算回顧一下c 的知識,而且這將對後面的討論和理解由一定幫助。先看乙個簡單的示例吧!如下 class mytest base void main catch 編譯...

mail 函式出錯的問題

出現的錯誤 warning mail function.mail tp server response 550 5.7.1 unable to relay for atoat sina.com in c webserver htdocs www mail.php on line 14 php.ini...

使用向量作為函式引數出錯

使用向量作為函式引數出錯 定義的時候是這個樣子 void dealstocktrade hq data hq,cmd commend,vector deallist,dbft sumprofit 使用的 如下 if q contact last m contact buy.flag 1 buy.am...