Unanswered: Mirror 2 mySQL tables, diff Servers, diff Databases
I have 2 tables on 2 different mySQL databases. I am looking for a way to Mirror each one to each other. If an entry gets made in one, it gets mirrored to the other. i also need this to be something easy, safe, secure way.
You can use MySQL replication to achieve this. However beware of Primary auto incrementing keys, and other keys which may conflict.
e.g. Simultaneous inserts
entry 1 -> db 1 , with primary auto key = 1
entry 1 -> db 2 , with primary auto key = 1
==> replicate db 1 to db 2 = ERROR!
==> replicate db 2 to db 1 = ERROR!
To avoid this you need to need to set the auto_incrementing key to jump numbers. i.e. entries in db1 start at 1 and have an increment of 2, and entries in db2 start at 2 and have an increment of 2.
Therefore the above scenario
entry 1 -> db 2 , with primary auto key = 2
I'm only talking about theory here and have never applied the above to real life DB application.