SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot Paul_M's Avatar
    Join Date
    Mar 2001
    Location
    London
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Backing up a MySQL DB

    Hi

    HOw do you backup a whole MySQL database and all its tables and all the data in them so that i can easily restore the data at a later date?

    Thanks

  2. #2
    SitePoint Enthusiast drisley's Avatar
    Join Date
    Jun 2001
    Location
    Florida
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the command:

    mysqldump -h[server name] -u[db username] -p[db password] [db name] > [path to backup directory]backup.sql

    Everything in brackets would need to be replaced with your own info, of course. This will backup the entire database into an SQL file in a directory on your server (wherever you specify)
    David Risley
    Web Developer, Web Publisher, Blogger, Tech Dude
    PC Mechanic | WebbyOnline

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There should be a utility program called mysqldump located in the bin directory inside the mysql directory on your server. The manual describes how you use this utility program http://www.mysql.com/doc/m/y/mysqldump.html

    Alternatively, if you have phpMyAdmin installed you can do a database dump using it.

  4. #4
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freakysid
    Alternatively, if you have phpMyAdmin installed you can do a database dump using it.
    ...although I wouldn't recommend it, especially if you have a large and/or mission-critical database.
    Kevin

  5. #5
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    although I wouldn't recommend it, especially if you have a large and/or mission-critical database
    Why? all phpmyadmin does is a screen dump, or to file, nothing more nothing less.

  6. #6
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php timeout issues, errors/bugs in phpMyAdmin dealing with quotes, the list goes on. In general I wouldn't recommend using anything but mysqldump for making a backup - using anything else you are running the risk of a corrupt backup (with mysqldump you are too obviously but the likelyhood's not nearly as high).
    Kevin

  7. #7
    SitePoint Zealot Paul_M's Avatar
    Join Date
    Mar 2001
    Location
    London
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the replies

    I will try the msqldump technique first.
    Otherwise will resort to the phpMyAdmin method.

    what about when/if i have to restore the data?

  8. #8
    SitePoint Member Craig Armstrong's Avatar
    Join Date
    Jun 2001
    Location
    Vancouver, WA, USA
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Paul_M
    what about when/if i have to restore the data?
    Check out Restoring your MySQL from Backup.
    --Craig Armstrong

    My site: coldplayonline.com
    Homepage: obscured.reflections

  9. #9
    SitePoint Zealot Paul_M's Avatar
    Join Date
    Mar 2001
    Location
    London
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx for the great link



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
  •