I am using mysqldump
to transfer a table from one database to another.
mysqldump -h host -u user -p password -e --single-transaction --no-create- info --default-character-set=utf8 --complete-insert --result-file=thisisaresult db table
I was wondering, however, if there is a way to change the name of the table you insert into? For example, I'd like this to insert into table_staging
, or something like that. Is this possible, or am I going to have to just use sed
?
After creating a mysql
dump file you could do the following:
sed -i 's/`old-table-name`/`new-table-name`/g' old-table-name.dump
The sed
command will search and replace the old table name with the new table name from within the mysql dump file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With