Use mysqldump to backup table with a new table name Is there a way to back up a table using mysqldump so the table that is being backed up can have a new name in the sql script created by mysqldump.

So that If I back up the table 'test_table' like so.

mysqldump -u user -p db_name test_table &gt; backup.sql


and I want 'test_table' to now be called 'test_table_backup' in the backup.sql that is created. 

CREATE TABLE `test_table_backup` (

...

);


I know i can just dump the file then craft some way to do a search and replace on the table name but I was hoping there was a safer way using mysqldump itself.
You have to use sed to transform the table name

mysqldump -u user -p db_name test_table | sed 's/test_table/test_table_backup/g' &gt; backup.sql


Give it a Try !!!