Firing an On Insert Trigger from Server A to Server B

Discussion in 'MySQL' started by mkb24, Apr 25, 2011.

  1. #1
    Hi

    I want to copy MySQL table data hosted on Server A to a MySQL Table hosted on Server B.

    I want to use an on insert Triggers on the MySQL table on Server A which will then insert the same row in an identical MySQL table on Server B.

    For data backup and auditing purposes.

    ****************************************************************

    Server A - Details

    IP - 205.168.5.45

    Database Name - dbnam1

    User Name - username1

    Password - password123

    Table Name - test

    ****************************************************************

    Whenever a record is inserted in table 'test' hosted on 205.168.5.45 ( Server A ), an on insert trigger will fire which inserts the same values into table 'test' hosted on 192.168.5.5 ( Server B ).

    **********************************************************************************
    Server B - Details

    IP - 192.168.5.5

    Database Name - dbnam2

    User Name - username2

    Password - password456

    Table Name - test

    ****************************************************************

    Using MySQL Triggers is this possible?

    Please guide me.

    Thanks in advance.

    Regards
    Meher Bala
    http://www.opensourcevarsity.com
     
    mkb24, Apr 25, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Best way to do it is replication. Your backup server automatically gets updated as the master server gets updated. It's not particularly difficult to setup, but is sometimes finicky to keep from getting out of sync.

    How are the servers connected to eachother?
     
    jestep, Apr 26, 2011 IP