How to get database backup in your mailbox daily automatically

get database backup in your mailbox daily automatically

Get Database Backup in your mailbox daily automatically

Few web host do not offer a daily backup of MySQL database while few offer extra charge for automatic backup.This PHP script will help you to get database backup in your mailbox daily automatically.

This script  performs three tasks.First it creates backup of MySQL database and save it server in .sql format.In second step it compress the .sql file and convert it in .zip format.At last ,it sends an email to provided email id with attached backup.To use this script you just need to assign the values for the variables $db_host ,$db_user,$db_pass,$db_name,$tables and $email.

To run this script automatically visit my post about  how to schedule a task with PHP .

Download the complete script from here.

Download Source

  • Get the mail but the data backup is not in file its showing 0kb.

    there is any error or need some extra code

    • You don’t need any extra file for this .First check your for db-backup-*.sql and db-backup-* files on your server.If they are not present then script is unable to import your tables and if they are present then there is problem to send the attachment and send me email with your web-host name if you are still unable to resolve the problem .

  • A very smart approach to explain the things, I like your
    step by step tutorial,

  • johnynite

    Awesome script bro.. Thanks a lot….

  • vovan

    Best Author.

  • BestFriend

    Wow ! Is It possible to get full backUp inluding files on server ?
    Thank you !