Mysql匯入指令碼失敗,提示需要SUPER許可權

2022-03-31 21:17:52 字數 1383 閱讀 3119

1.刪除:

/*!50013 definer=`root`@`localhost` sql security definer */

2.檢視增刪函式有沒有重複

3.刪除:

set global log_bin_trust_function_creators=on;

1. 錯誤資訊

[err] 1227 - access denied; you need (at least one of) the super privilege(s) for this operation

--常見於 rds mysql 5.6

error 1725 (hy000) at line 1936: operation need to be executed set by admin

--常見於 rds mysql 5.5

2. 錯誤出現的場景

3. 錯誤原因

4. 解決

4.1 去除 definer 子句

檢查sql檔案,去除下面類似的子句

definer=`root`@`%` 

在linux平台下,可以嘗試使用下面的語句去除:

sed -e 's/definer[ ]*=[ ]*[^*]*\*/\*/ ' your.sql > your_revised.sql

4.2 去除 gtid_purged 子句

檢查sql檔案,去除下面類似的語句

set @@global.gtid_purged='d0502171-3e23-11e4-9d65-d89d672af420:1-373,

d5deee4e-3e23-11e4-9d65-d89d672a9530:1-616234';

在linux平台,可以使用下面的語句去除

awk ' } else  }' your.sql | grep -iv 'set @@' > your_revised.sql

4.3 檢查修改後的檔案

修改完畢後,通過下面的語句檢查是否合乎要求。

egrep -in "definer|set @@" your_revised.sql

如果上面的語句沒有輸出,說明sql檔案符合要求。

Mysql匯入指令碼失敗,提示需要SUPER許可權

1.刪除 50013 definer root localhost sql security definer 2.檢視增刪函式有沒有重複 3.刪除 set global log bin trust function creators on 1.錯誤資訊 err 1227 access denied ...

MySQL匯入資料提示max allowed

mysql匯入資料提示max allowed packet錯誤的解決方法 mysql 5.1 遇到的資訊包過大問題 用客戶端匯入資料的時候,遇到 錯誤 1153 got a packet bigger than max allowed packet bytes 終止了資料匯入。當mysql客戶端或m...

mysql匯入sql指令碼

例如 我的使用者名稱是root 密碼是123 sql指令碼存在c盤 名字為test.sql 資料庫為test 有兩種方法可以執行指令碼 1 開啟cmd輸入以下命令 不需要轉換目錄 mysql u root p123 進入mysql 後mysql use test mysql source c tes...