November 28th, 2012, 08:52 PM
Copy/Synch one table in two databases
I have a noob question . Maybe someone can help me with this.
Here is the scenario:
I have two databases "db_1" and "db_2" on the same MYSQL Server for two LAMP websites ("site_1" and "site_2").
They both have tables named "A" and "B".
I need to make sure that the data from table "A" in "db_1" gets copied in regular intervals into table "A" in "db_2". It should be an exact copy of the table "A" in "db_1".
"db_1" writes and reads it's table A but "db_2" only reads it's table "A".
The tables called "B" have the same name in "db_1" and "db_2" but contain different data and are not compatible. So I cannot use one database.
Sadly "site_1" and "site_2" are build on a CMS and I am not allowed to change any of their core PHP. That means I can't let them write/read from the same table "A".
Any idea how I can safely synch this table over two databases?
November 28th, 2012, 09:18 PM
But you can change the database stuff, right?
Make the read-only table be a VIEW of the "master" table. No copying required.
November 28th, 2012, 09:29 PM
That could be exactly what I need.
Originally Posted by requinix
Thanks for the quick reply.
Update: Worked perfectly.