SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mysql back up with PHP

    Hi everyone!!

    I just wanted to know how phpmyadmin can backup a database using queries? or does it do the job some other way like writing to a file all the necessary sql statement to back up the database?

    If anyone has any idea of how is it done or if anyone can teach me ho to do it the same way, so i can incorporate it in my own project, please help me.

    Any form of help, be it ideas or the answer itself will be appreciated much.

    Thank You.

  2. #2
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysqldump
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  3. #3
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if im not mistaken, mysqldump has a command prompt like environment. If your suggesting mysqldump, then it can be done on a browser with php.

    is this true? can you give me an example, because from ehat i have read, its by cmd, not by browser.

  4. #4
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming access is configured correctly, you can execute a mysqldump command via a web script. That's why we have exec() and system(), etc functions in PHP.

    I don't use mysqldump to backup my DBs, so I'm not familiar with the details of the command options you'd need, but a simply 'mysqldump --help' would tell you that.

    I run all my own servers, so when I need to backup a DB, I just tar/bz2 the DB directory. :-)
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  5. #5
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look a this thread.
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  6. #6
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I could also do that, but im doing a project for the school, and i dont want to have such instructions as back up database by droping to drive c and zip it!!

    no offense, but with your post, im relieve, im going to start searching about that exec and system.

    Thanks man!!

  7. #7
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow TOLY your heavens SCENT!!!
    hhahahaha
    i mean Sent!!

    thats sweet!!! thanks man!!

  8. #8
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im downloading every page of that thread, havent read all of it, but does it include restoring the db? Toly hope you reply asap


  9. #9
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lance_vincent
    does it include restoring the db?
    Nope, only backing it up.

    To restore a database you would use: mysql -u username -p db_name < backupfile.sql. But I have never tried to run that through that script.
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  10. #10
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you think such would work, i would like to try it now, but im facing a new problem, actually, i think im having a badluck day!! my query broweser and administrator doesnt work anymore after i uninstalled mysql4 for mysql5. i tried reinstalling the two, but nithing. any hint on this one?

  11. #11
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh before i forgot, im also having that problem 1 error, im not on linux so i cannot apply that chmod solution you presented. im on winxp, and im using mysql4.0 at home. i tried tp write to c:\, the .sql file was written, but nothing is written. tried writing to c:\mysql\data\databasename\ also the same problem.

    what am i doing wrong? or am i stupid!! hope you dont look at me like a total idiot!!

    as a sitepoint mentor, hope youll be able to help me. or you can ask maybe others from your thread. maybe ill post this there? nice idea... for an idiot!!

    hehehe


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •