1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Buying Copy Database via Cron

Discussion in 'Programming' started by tomupton, Nov 26, 2009.

  1. #1
    Hi All,

    Im looking for a solution for the following problem

    OK here is the situation.

    I have 2 databases on the same server under seperate domains.

    The databases are identical and hold exactly the same information.

    What im looking at doing is setting up a cron so on a daily basis Database1, is copied over to Database2. Or even better if this can be done in realtime without using a cron.

    The sites are currently on a Cpanel Server and have been developed using PHP and Mysql.

    Whats the best solution going forward?

    Regards
    Tom
     
    tomupton, Nov 26, 2009 IP
  2. stOK

    stOK Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    did you try http://www.phpmyadmin.net/ ?
    Or even better
    mysqldump

    PS if both databases on the same host you can have just one and easily access it from both sites.
     
    Last edited: Nov 26, 2009
    stOK, Nov 26, 2009 IP
  3. tomupton

    tomupton Active Member

    Messages:
    392
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Hi Mate,

    Thanks for your reply.

    Yes the server has PHPMyAdmin installed. Both sites are on the same server.

    I have considering doing a daily or weekly database dump, but ideally i would like to automate the process and let this all happen automatically.

    Whats the best way forward with this?

    Regards
    Tom
     
    tomupton, Nov 26, 2009 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    Can you tell me is this a vps or dedicated server ??
     
    Bohra, Nov 26, 2009 IP
  5. tomupton

    tomupton Active Member

    Messages:
    392
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    Its on a dedicated server mate, with WHM and Cpanel
     
    tomupton, Nov 26, 2009 IP
  6. ifreakz

    ifreakz Well-Known Member

    Messages:
    1,427
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    130
    As Seller:
    100% - 0
    As Buyer:
    0.0% - 0
    #6
    SQLYog
    It's an application which you can install on your pc and perform all kind of such tasks, you may also compare and match with your a database on a remote server (Maybe your own pc - running with xampp)
     
    ifreakz, Nov 26, 2009 IP
  7. tomupton

    tomupton Active Member

    Messages:
    392
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    Thanks for the reply.

    Im currently using this, but ideally i would like to do this remotely and have it automated etc.

    Tom

     
    tomupton, Nov 26, 2009 IP
  8. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    are the mysql databases on the same cpanel account?

    if they are then in your php coding where it does the mysql querys to put info into the database do the same query twice one for database 1 and another for database 2

    then anyinformation that is input will be put in database 1 & 2
    -John
     
    jpinheiro, Nov 26, 2009 IP
  9. tomupton

    tomupton Active Member

    Messages:
    392
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    Hi John,

    They are on 2 seperate hosting accounts by on the same server.

    i.e. Domain 1 - Domain 2

    Ive tried adding Domain 1's database info in domain 2 connection scripts but for some reason this isnt working.

    Regards
    Tom

     
    tomupton, Nov 26, 2009 IP
  10. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    jpinheiro, Nov 26, 2009 IP
  11. tomupton

    tomupton Active Member

    Messages:
    392
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #11
    No there are 2 totally seperate websites, and need to be kept independant.

    Thanks for everyones help here, its much appreciated
     
    tomupton, Nov 26, 2009 IP
  12. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #12
    this looks like it can only be done manually .. I am willing to do it manually daily for $10 a week

    -John
     
    jpinheiro, Nov 26, 2009 IP
  13. travelmoth

    travelmoth Active Member

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #13
    really do NOT understand....two websites(two domains)...can share one database.......why you need two identical database? I never saw this kind requirements. If you need backup your database.....you can do it every week/every day......or even every hour.........

    Now..I believe your two db are on the same hard disk........if the hardware has problem..both of them have problem.
     
    travelmoth, Nov 26, 2009 IP
  14. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #14
    If it is your own server, why not use OUT FILE and LOAD FILE of Mysql?

    It will be fast and accurate. More over 2 queries will make life simpler for cron writer too.

    If you know how to write a cron, I can help with mysql queries to get the job done :)
     
    mastermunj, Nov 26, 2009 IP
  15. schoash

    schoash Active Member

    Messages:
    291
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #15
    I can help you with that. mysql replication should do the job, in realtime.
     
    schoash, Nov 26, 2009 IP