Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要每天将一张表从 olddb 移动到新 db。我想知道是否可以只在一个命令中运行这两个命令?不创建 .sql 文件
mysqldump -u user olddb table_name > moving.sql mysql -u user newdb < moving.sql
mysql -u user -p -e 'insert into newdb.table_name select * from olddb.table_name'
UPD
使用条件:
mysql -u user -p -e 'insert into newdb.table_name select * from olddb.table_name where olddb.table_name.mydate > ...'