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[ ]*=[ ]*[^*]*\*/\*/' > dump.sql
Best Answer
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 toWith some guts, simply
I'm not clear that the regexp does the right thing; please provide a sample.