MySQL database sync Via PHP

Discussion in 'MySQL' started by tonyrocks, Nov 19, 2009.

  1. #1
    I was wondering if anybody had any insight on the best way of doing this. I'm looking for an automated process I can CRON:

    I have two separate servers (both running LAMP). One is a live server, the other is the test server. I would like to copy data from live mysql db to test mysql db once a week so that test contains a "mirror" of live.

    I know I can just do an export from one to the other, but is there a way to do this automatically? Taking into consideration that each DB are not on the same machine?
     
    tonyrocks, Nov 19, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    well, instead of doing it in php write a shell script (or get it done) which dumps data from production server and imports it into test server, which will be fast and accurate.
     
    mastermunj, Nov 19, 2009 IP
  3. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #3
    mwasif, Nov 20, 2009 IP
  4. tonyrocks

    tonyrocks Active Member

    Messages:
    1,574
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    88
    #4
    I don't have much experience with MySQL Replication, but it seems to be the way to go. Wish me luck :)
     
    tonyrocks, Nov 20, 2009 IP
  5. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #5
    Wish you best of luck dear. You are always welcome to ask questions about MySQL replication. I have some experience with it.
     
    mwasif, Nov 20, 2009 IP