1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Use Curl to import MySQL database?

Discussion in 'PHP & Perl' started by theadultsplayground, Dec 6, 2009.

  1. theadultsplayground

    theadultsplayground BANNED BANNED

    Joined:
    Jan 24, 2008
    Messages:
    1,202
    Likes Received:
    336
    I have a small problem that maybe someone on here can help me out with. I have a MySQL database that is the back end for a website of mine. Although I allow users to make changes to the demo website I need it to reset back to it's original data every 6 hours (maybe every 24hrs). This would require me to make a copy of the database (I can just store it in a directory on my website and kick off a cron job that would import the sql file (and overwrite the existing data).

    Anyone know the syntax for this cron job (I don't have to use Curl).
     
  2. Kaimi

    Kaimi Newbie

    Joined:
    Dec 6, 2009
    Messages:
    35
    Likes Received:
    230
    Home Page:
    Someting like this? * 6 * * * php /home/account/restore_database.php > /dev/null
     
  3. theadultsplayground

    theadultsplayground BANNED BANNED

    Joined:
    Jan 24, 2008
    Messages:
    1,202
    Likes Received:
    336
    That looks like its calling a php file. Do you have a script that will do this task?
     
  4. Kaimi

    Kaimi Newbie

    Joined:
    Dec 6, 2009
    Messages:
    35
    Likes Received:
    230
    Home Page:
    Php script to restore db from dump? Try this http://d15.biz/blog/2006/12/restore-mysql-dump-using-php/
     
    • Thanks Thanks x 1
  5. theadultsplayground

    theadultsplayground BANNED BANNED

    Joined:
    Jan 24, 2008
    Messages:
    1,202
    Likes Received:
    336
    Works like a charm. Thanks.