Skip to content

Instantly share code, notes, and snippets.

@hanhpv
Created December 27, 2016 10:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanhpv/85f6d64f2b934687802e21bf721af965 to your computer and use it in GitHub Desktop.
Save hanhpv/85f6d64f2b934687802e21bf721af965 to your computer and use it in GitHub Desktop.
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