MySQL Database backup from shared Server to local  Machine / Network

Posted on 2012-08-31
Last Modified: 2012-09-04
I manage several web applications that make use of MySQL databases.

Most of these are hosted by GoDaddy or 1 & 1.

I recognize that the databases are backed up by the hosting company on a regular basis.

In several cases we want to institute a process where our database is automatically backed up  on a regular basis (daily, weekly). I envision a chron job running on the web server backing up the database. But I want to extend the process so I can download (automatically) to a local machine or network the completed backup (zipped) .

What are the best ways to do this?

Question by:Richard Korts
    LVL 17

    Accepted Solution

    Well, to get the data exported is a simple, one-step solution ... just use "mysqldump", e.g.

    mysqldump [-A] -p PASSWORD -u USER [database] >dump.sql

    Use either -A to dump all databases available to the user, or name the database you want exported as an argument.

    The Cron script can then compress the output-file:

    bzip2 dump.sql

    resulting in the file "dump.bz2" (any other compressor will of course also work)

    To automatically download the file, there's multiple options, depending on your setup. If you have a server that has a public IP address, you could set up either a remote copy using a plain FTP upload (you may want to encrypt the data before transferring with FTP), or use scp (requires a key auth in order to transfer); if you do not have a public IP, you could turn it around, retrieving the backup files via scp ...
    LVL 11

    Expert Comment

    by:Pradeep Dubey
    I suggest you to take a look of below backup solution:

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
    This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now