The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Easy way to backup all MySQL db on server?

Discussion in 'General Discussion' started by embsupafly, Jul 12, 2006.

  1. embsupafly

    embsupafly Active Member

    Joined:
    Dec 24, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    Is there an easy way to backup all of the MySQL databases for all accounts on the server. I am going to upgrade from 4.0.x to 4.1.x and need to backup all of the dbs before doing so.
     
  2. kistler

    kistler Well-Known Member

    Joined:
    Jan 27, 2005
    Messages:
    136
    Likes Received:
    0
    Trophy Points:
    16
    You can use the myself dump in ssh but it not 100% easy if you haven’t done it before

    Easy maybe...
    http://www.phpmybackuppro.net/ - very fast and doesn’t use much resources


    When I updated mysql, I didn’t have an issue with any account – I’d still backup
     
  3. apea2rh

    apea2rh Member

    Joined:
    Jul 3, 2006
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    You could just do this as root through ssh:

    cp -R /var/lib/mysql/ /backup/tmp/mysql/
     
  4. elix

    elix Well-Known Member

    Joined:
    Jan 18, 2005
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    You might also want to create a tar.gz file for each database, as opposed to huge archive.

    You can use the following bash script to accomplish this:

    Code:
    #!/bin/bash
    
    
    ## Specify the directory for these backups, be sure to make sure it exists.
    BACKUPDIR="/backup/sql"
    
    clear
    
    echo -n "Creating archives on a per database basis..."
    
    for i in `ls /var/lib/mysql`
    do
       tar -czf $BACKUPDIR/$i.tar.gz $i
       echo -n "."
    done
    echo -n "Process complete."
    
    exit 0
     
  5. mohit

    mohit Well-Known Member

    Joined:
    Jul 12, 2005
    Messages:
    553
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Sticky On Internet
    HI,
    and how do one restore the files available under the /var/lib/mysql/user_db/
    the files are :-

    *.MYI
    *.MYD
    *.frm

    any steps to get this back working if you are restoring the DB's manually.

    regards,
    mohit
     
Loading...

Share This Page