Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix Mysql error The user specified as a definer ... does not exist
sed -i -e 's/DEFINER=`root`@`10.%`/DEFINER=CURRENT_USER/g' filename.sql
@hanhpv
Copy link
Author

hanhpv commented Aug 27, 2018

Updated: remove DEFINER completely

sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' filename.sql

@hanhpv
Copy link
Author

hanhpv commented Aug 27, 2018

Export database dump without DEFINER

mysqldump -h <database host> --user=<database username> --password=<password> --single-transaction main | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | gzip > /tmp/database_no-definer.sql.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment