Skip to content

Instantly share code, notes, and snippets.

@arnisjuraga
Last active April 15, 2020 10:17
Show Gist options
  • Save arnisjuraga/a377c591bdddda17b00108beb0bad1ed to your computer and use it in GitHub Desktop.
Save arnisjuraga/a377c591bdddda17b00108beb0bad1ed to your computer and use it in GitHub Desktop.
Remove DEFINER from MySQL mysqldump tool backup file
#
# Documented from https://stackoverflow.com/questions/9446783/remove-definer-clause-from-mysql-dumps
#
cat backupfile.sql | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | sed -e 's/DEFINER[ ]*=[ ]*[^*]*PROCEDURE/PROCEDURE/' | sed -e 's/DEFINER[ ]*=[ ]*[^*]*FUNCTION/FUNCTION/' > result.sql
#
#
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment