Synchronize two distinct mysql databases
So, I am building a new e-commerce application for my company with a brand new normalized database. Currently, there is an old database, non normalized awful database. The old database has about 5 legacy sy开发者_运维技巧stems still running on it so it will still be in production when my application is launched. The question being as a legacy application updates data in the old database, how can I update the data into the new database?
You need to create a TRIGGER on the old one, so when insert/update/delete is performed, it should replicate the change in the other database properly.
In the trigger you can handle any differences between the two schemas.
The user needs to have permission for both of the database, and in the trigger tables must be prefixed with database name like mydb.table2
I am not sure if it will fit your requirement but you could try to set up replication on both servers.
http://dev.mysql.com/doc/refman/5.1/en/replication.html
精彩评论