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 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes this is possible in MySQL using following approaches:
Table Federation: Create a new federated table same as main table having
ENGINE=FEDERATEDwhich 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
TRIGGERon main table andAFTER INSERTon main table insert into federated table.Replication: Setup a replication from server1 (MASTER) to server2 (SLAVE) and add this table in replication.