Best way to do a database backup?

Discussion in 'MySQL' started by rick sample, Oct 15, 2005.

  1. #1
    First let me state I have tried utility after utility. I've dowloaded many problems, everyone which seems to can't connect to the database or it'll return an error right before it finishes.

    I've just discovered PHPMYADMIN installed on our server. I went to the exports tab, selected to export all in that particluar database and I clicked go to download. Right now it is downloading as one SQL file, is this a good way to download a backup or a bad way? By this I mean if my database were to ever go corrupt, would I just reupload that SQL file and it'll go back to the day I dowloaded that without any problems?

    Any advice would be great!
     
    rick sample, Oct 15, 2005 IP
  2. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The answer is yes. cPanel if you use it has a good utility to do backups also.
     
    ServerUnion, Oct 15, 2005 IP
  3. my3cents

    my3cents Peon

    Messages:
    332
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you use MySQL there is a command you can run (or schedule in CRON) to do the backup periodically.

    mysqldump myDBname | gzip >/home/backups/mysql_db.gz

    This dumps every table of your database into a zipped file format. If you were to try and restore your database, you would just need to "run" the query it created. Basically it is a giant file with CREATE TABLE statements and INSERT statements that rebuilds your entire database from scratch. So you can run it in a completely new database environment, or your existing if necessary.

    Good luck!
     
    my3cents, Oct 17, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Also, if you are using all MyISAM tables, you might want to use mysqlhotcopy. (it's faster)
     
    digitalpoint, Oct 17, 2005 IP