Example task: Multiply the table holidays between several stages.
- 
Open two terminals: shell-for stage_1 shell-for stage_2
- 
Get the stage1 and stage2 MySQL credentials: cat /opt/www/the_stage.host.tld/current/config/database.yml cat config/database.yml # should do it
- 
Dump the table to a path reachable by the stage2 user (e.g. home): mysqldump -h mysql1 -u stage_1_user -p stage_1_database table_name > ~/table_name_dump.mysql # Select certain records using --where "some_id > 666"(-h stands for hostname and it is in deed 'mysql1') 
- 
Import the dump: mysql -h mysql1 -u stage_2_user -p stage_2_database < /home/stage_1_user/table_name_dump.mysql # attention to stage1 and stage2
Note that importing a table overwrites an existing table. There won't be a magic merge.
Posted by Martin Straub to makandra dev (2012-09-27 10:13)