Reputation: 7748
I need to move a table each day from olddb to new db. I wonder if it is posisble to run this two commands in only one? without creating the .sql file
mysqldump -u user olddb table_name > moving.sql
mysql -u user newdb < moving.sql
Upvotes: 0
Views: 610
Reputation: 5724
mysql -u user -p -e 'insert into newdb.table_name select * from olddb.table_name'
UPD
to use consition:
mysql -u user -p -e 'insert into newdb.table_name select * from olddb.table_name where olddb.table_name.mydate > ...'
Upvotes: 1