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.

MySQL backup

Discussion in 'Database Discussions' started by p.martin, Feb 23, 2011.

  1. p.martin

    p.martin Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I wanted to backup my MySQL databases and send them automatically to another server.

    I was told that it's not possible with the cPanel backup wizard.

    Assuming I only have FTP access on the other server, a cron task like that would work ? :
    (given by Ken at support but he wasn't sure)

    Code:
    0 1 * * * /usr/bin/ftp /var/lib/mysql user:password@IP:/pathtocopybackup
    Thanks for your help.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I'm a bit confused, why isn't the WHM > Backup > Configure Backup option "Backup SQL Databases (at least "Per Account" is needed to use the restore feature)" able to handle remote FTP backups precisely? You should be able to only back up your MySQL databases in that area and have them FTPed to a remote machine unless you want to have both backups (account and MySQL) but only send the MySQL ones to the remote FTP server.

    The command you've provided will not back up your MySQL databases properly. You should grab a dump file and then scp that dump to the remote machine:

    Code:
    mysqldump --all-databases > /home/alldatabases.sql
    Put the above into a bash script, then cron run the bash script. The bash script can include scping the file as well to the remote machine after it has been created.
     
  3. p.martin

    p.martin Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the reply.

    John Kata at support:

    I don't have ssh access on the other server, only FTP. I didn't realy understood the dump file system but should a cron like that be better ?

    Code:
    0 1 * * * /usr/bin/ftp /backup/cpbackup/daily/dirs/_var_lib_mysql_.tar.gz user:password@IP:/pathtocopybackup
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you already have cPanel making a backup of the directory, you could certainly use that backup instead for the cron.
     
Loading...

Share This Page