Skip to content

Instantly share code, notes, and snippets.

@nickdotht
Created March 24, 2020 11:39
Show Gist options
  • Save nickdotht/2e1020b57fca4b999b9ba1f3705f508b to your computer and use it in GitHub Desktop.
Save nickdotht/2e1020b57fca4b999b9ba1f3705f508b to your computer and use it in GitHub Desktop.
Commands to dump a MySQL DB without the definer.
mysqldump -h [DB-HOST] --databases [DB-NAME] -u[DB-USER] -p | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > ./[OUTPUT-FILE-NAME].sql
mysqldump --no-data --single-transaction=true -h[DB-HOST] -u[DB-USER] -p --databases [DB-NAME] | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > [OUTPUT-FILE-NAME].sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment