MySQL - Dumping 1TB database with SED to replace definer Im going to dump a large database more than 1TB using MySQLDUMP (unfortunately I have to stick with mysqldump, I can't use mydumper or any other backup tools)
And I want to replace the definer on the fly during the backup.
So if I use sed with dump command, will it take more time than the normal mysqldump?
mysqldump db name | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' &gt; dump.sql
First, dump only the routines, not any of the data.  That way it should be quite fast -- drop a routine, rebuild it.  Rinse, repeat.
As for the regexp, the format should be very regular, so [ ]* (or \s* can probably be simplified to  .
[^*]* --&gt;  .*\*

With some guts, simply
mysqldump ... | set -e '...' | mysql ...

I'm not clear that the regexp does the right thing; please provide a sample.