How to fix -- ERROR 1227 (42000) at line 728: Access denied; you need (at least one of) the SUPER privilege(s) for this operation -- ?

error become from SQL file from these strings ( this error very popular in magento 2 databases):

CREATE ALGORITHM=UNDEFINED DEFINER=

need to replace it with

DEFINER = CURRENT_USER

OR

Create new DB user for existing DB or create both db + new user and use name of new user below

Also its possible to replace all strings with your REAL DEFINER = `your_db_user`@`localhost` with your real data on your current server.

For example replace with DEFINER =  `your_real_db_user`@`127.0.0.1:3312` -- use your real db user and real DB server IP and port

replace all similar string combinations in your SQL file

 

Once you will save changed sql file you will be ready for import it into DB

But if you will do it under other db user than you used in your replacements then you will have same error.

So you MUST to do import DB in SSH under your_real_db_user and use his password of course

mysql -u your_real_db_user -p DATABASE < backup.sql