1

I want to create a MYSQL Stored procedure when I insert data into the table, the data will get inserted in other server table too.

I know this is possible in ORACLE databases but I don't know if It works in MYSQL.

Is there any way to do this ?

Shikiryu
  • 10,070
  • 7
  • 48
  • 74
opc0de
  • 11,342
  • 14
  • 89
  • 184

2 Answers2

1

Yes this is possible in MySQL using following approaches:

  1. Table Federation: Create a new federated table same as main table having ENGINE=FEDERATED which will have a MySQL connection string username password and host id of other server. Onother server you need to create a new user and give insert grants to this user. Write a TRIGGER on main table and AFTER INSERT on main table insert into federated table.

  2. Replication: Setup a replication from server1 (MASTER) to server2 (SLAVE) and add this table in replication.

Omesh
  • 26,034
  • 6
  • 40
  • 50
0

Do you want to replicate all data (in the table) between a number of databases periodically?

http://dev.mysql.com/doc/refman/5.0/en/replication.html

or do you want to propagate an insert?

your answer may be in

How to create linked server MySQL

Community
  • 1
  • 1
Germann Arlington
  • 3,299
  • 2
  • 16
  • 19