Created
December 27, 2016 10:11
-
-
Save hanhpv/85f6d64f2b934687802e21bf721af965 to your computer and use it in GitHub Desktop.
Fix Mysql error The user specified as a definer ... does not exist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i -e 's/DEFINER=`root`@`10.%`/DEFINER=CURRENT_USER/g' filename.sql |
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
Updated: remove DEFINER completely
sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' filename.sql