Automatically Send MySQL Database Backup To Gmail

Martin Brinkmann
Jul 13, 2009
Updated • Nov 29, 2012
Backup, Development
|
6

Webmasters have to make sure that their websites and files are getting backed up regularly to be prepared when something unforeseen happens. This unforeseen event can be a hacker attack, a database crash, a fire in the data center of the hoster or human error. Whatever the cause is it can have a severe impact on the service and business if backups are not available to restore the website or service.

Many web hosting companies offer backup space and create backups regularly. Some on the other hand ask for additional payments or do not offer this backup service at all. It then is up to the webmaster or server administrator to ensure that the data gets backed up regularly so that it can be restored when needed.

One option that is becoming increasingly popular is to backup data and send it to an offsite storage space. Backup2Mail is such a script. It can initiate automatic MySQL database backups on Linux servers using cron jobs and transfer these backups to a Gmail account. The only restriction is that the size of the zipped database should not exceed the maximum attachment limit of Gmail which is currently 25 Megabytes.

The developer provides instructions on how to setup the MySQL database backup and Gmail transfer on his website. It basically means that the user needs to edit an index.php file to provide the script with the MySQL information and GMail data. The only thing left after this step is to create a cron job so that the script is executed regularly on the server. Backups will from then on be created automatically on the web server and send to the Gmail account.

Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Claude LaFrenière said on September 14, 2012 at 5:52 pm
    Reply

    Hi Martin Brinkmann :)

    In my Windows 7 this is already done in the Task Scheduler by the default installation… The command line is:

    %windir%\system32\rundll32.exe /d srrstr.dll,ExecuteScheduledSPPCreation

    :)

    1. Martin Brinkmann said on September 14, 2012 at 6:22 pm
      Reply

      Thanks for posting that, easier than my way. Have not tried it yet though but will. Wonder why I do not have it.

    2. ilev said on September 14, 2012 at 8:31 pm
      Reply

      I have it as well but it was configured to run only when the PC is idle.

      Task Scheduler > Task Scheduler Library > Microsoft > Windows > System Restore.
      There are 2 triggers : at 00:00 every day, at startup.

      1. Rich said on September 15, 2012 at 4:07 am
        Reply

        Much easier and simpler method is at tweaking.com Registry Backup. It runs at startup and invokes VSS to copy registry and keeps last 30 days for restores. Can be invoked within MSFT Recovery Console so better suited to non-boot situations. No authority issues either.

  2. Michael said on September 16, 2012 at 4:57 am
    Reply

    My task scheduler is also configured this way. But it doesn’t work. My system does NOT make a restore point every time it boots. Its typically not running at midnight.

  3. Achilles Khalil said on September 16, 2012 at 6:57 am
    Reply

    Hi this is achilles Seo Expert and website designer and developer. I am here to tell you if need help or need any seo expert contact me I can design any kind of site for any country and Optimize with search engin also can bring your site at TOP. Please feel free to contact me. Whoever your work is great awesome. Be Happy.

  4. Frantic said on September 16, 2012 at 10:33 pm
    Reply

    How is this done in Windows XP, I wonder?

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.