Access denied; you need (at least one of) the SUPER privilege(s) for this operation

后端 未结 12 1004
余生分开走
余生分开走 2020-12-12 14:26

So I try to import sql file into rds (1G MEM, 1 CPU). The sql file is like 1.4G

mysql -h xxxx.rds.amazonaws.com -u user -ppass --max-allowed-packet=33554432 db <

12条回答
  •  粉色の甜心
    2020-12-12 14:41

    Full Solution

    All the above solutions are fine. And here I'm gonna combine all the solutions so that it should work for all the situations.

    1. Fixed DEFINER

    For Linux and Mac

    sed -i old 's/\DEFINER\=`[^`]*`@`[^`]*`//g' file.sql
    

    For Windows
    download atom or notepad++, open your dump sql file with atom or notepad++, press Ctrl+F
    search the word DEFINER, and remove the line DEFINER=admin@% (or may be little different for you) from everywhere and save the file.
    As for example
    before removing that line: CREATE DEFINER=admin@% PROCEDURE MyProcedure
    After removing that line: CREATE PROCEDURE MyProcedure

    1. Remove the 3 lines Remove all these 3 lines from the dump file. You can use sed command or open the file in Atom editor and search for each line and then remove the line.
      Example: Open Dump2020.sql in Atom, Press ctrl+F, search SET @@SESSION.SQL_LOG_BIN= 0, remove that line.
    SET @@SESSION.SQL_LOG_BIN= 0;
    SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '';
    SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;
    
    1. There an issue with your generated file You might face some issue if your generated dump.sql file is not proper. But here, I'm not gonna explain how to generate a dump file. But you can ask me (_)

提交回复
热议问题