auto backup mysql database using php script

If your site is live and using Database then it is very important to take a backup of your Database at a regular time interval. But it is not possible to take the backup manually every time. So let’s create a simple PHP function to do this job for us and we can call that function using Cron Job in regular time intervals.
Click here to know how to import the MySQL database.

[su_button background=”#ef2d33″ size=”5″ icon=”icon: download” download=”dbbackup.php” target=”_blank” url=”” id=”download”]Download[/su_button]

Save the above code in a PHP file and upload the file to your webserver then run the file. And check if it creates a folder called Backup and creates the backup .sql file inside the Backup folder. If the file works fine then you can assign the file to your Cron Job.