How To Back Up The Entire MySql Database with PHP

Have you experienced data loss because the database was never backed up? yes, I just experienced because my hard drive has been damaged. From this experience, I am trying to make a short script to back up the entire MySQL database in bulk. If you have hundreds of databases, and to backup manually definitely exhausting and very boring. For that, you can use a simple script that I created to perform backup the entire MySQL database with PHP. Let’s follow the tutorial below:

A brief description:

$restric_db=array('information_schema','mysql','performance_schema','phpmyadmin') The above array is used to hold the database’s name that does not participate to back up

In this example, I create a folder with the format date(‘Y-m-d’) to accommodate the entire back up’s file. Each performs a backup process, the system will check whether the folder already exists or not. If no, the system will create a new folder.