There are many ways of migrating MySQL data from server to server and its just essential to use mysqldump or any other tools to do the task for you.
The simplest way to do this is via mysqldump (from source) then mysql (into target).
However, in my case I have an already existing database with data and I need to append later data into this database from a more recent mysql data source.
This script will help you accomplish that.
It has simplified the process:
– mysqldump data from source
– import data into target
– will fetch all tables from source and attempt to insert them into the target.
– will only process one table at a time
This works best for database architectures that implement replication. However, ensure that the target slave must be stopped first before running this script to prevent problems due to data inconsistencies.
A limitation of this process is that it is one-way and not bi-directional.
Copy the source-code and paste it into a file. ie. migrate.sh
Tested using the following:
– Centos Linux 7
– MySQL 5.0 Server
– MySQL 5.5 Client
Note:
– Does not work with MySQL 5.0 Client