Replace the Engine used in mysqldump

Just a little bash snippet to replace the ENGINE type used in a mysqldump. Slightly modified from this stackoverflow thread to perform the dump and replacement in a single step.

To dump to a file…

mysqldump -h hostname -u root -p --routines --databases db_name | sed -re 's/^(\) ENGINE=)MyISAM/\1TokuDB/gi' > output.sql

To copy directly to another mysql server. N.B. You need to provide the passwords on the command line here. The database should not exist on the other server.

mysqldump -h hostname -u root -pSECRET--routines --databases db_name | sed -re 's/^(\) ENGINE=)MyISAM/\1TokuDB/gi' | mysql -h hostname -u root -pSECRET;

Leave a Reply