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

First create backup / export of database using these steps:

1. Enter to SSH.

2. Run command:

database dump:

mysqldump --add-drop-table -u your_user -p your_db > ~/your_host_db_20151001.sql (insert your DB user name and host name instead of your_user and your_host)

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


need to replace it with



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`@`` -- 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

Import database

mysql -u your_real_db_user -p DATABASE < backup.sql


Also exist not tested way to fix it

zcat var/db.sql.tgz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | mysql -h <db-host> -P <db-port> -p -u   <db-user> <db-name>