I don’t think there is a way to ignore adding DEFINER
s to the dump. But there are ways to remove them after the dump file is created.
-
Open the dump file in a text editor and replace all occurrences of
DEFINER=root@localhost
with an empty string “” -
Edit the dump (or pipe the output) using
perl
:perl -p -i.bak -e "s/DEFINER=\`\w.*\`@\`\d[0-3].*[0-3]\`//g" mydatabase.sql
-
Pipe the output through
sed
:mysqldump ... | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > triggers_backup.sql