DoBackup is a free software that generates backup files of MySQL databases. Written in PHP, the tool can be used on the many platforms where this language is supported, including Windows, Mac OS and Linux.
The software makes backing up databases as easy as visiting a web page: just request the script's URL in an HTTP client, for example a web browser.
Combined with command-line tools like wget or curl, the script can also be run as a scheduled task and can help database administrators to back up their data on a regular basis.
Several compression methods are available to reduce the size of the backup files it generates. Gzip and Bzip2 are the two formats currently supported.
DoBackup is freeware, see the COPYING file for further details about the license.
The distribution includes the following files:
- A MySQL server, and a web server with PHP 5 or greater enabled
- PHP's Zlib support enabled if using Gzip compression
- PHP's Bzip2 support enabled if using Bzip2 compression
- Writing privileges on the output directory to the web server
- A little bit of PHP knowledge to edit the configuration file
To run it, the script has to be requested in HTTP, by simply visiting its URL, using a web browser for example. Each time it is run, it generates a backup file in ./backup (this directory must exist, and your web server needs to have writing privileges on it) named db-YYYY-MM-DD where YYYY, MM and DD respectively match the current year, month and day. According to its compression, an extension is also appended to this name:
The file is not compressed.
The file is compressed in Gzip format.
The file is compressed in Bzip2 format.
The backup file is a text file that may become large if your database is large. To save disk space, it is possible to generate compressed backups in Gzip or Bzip2 format, by respectively passing the argument compression=gzip or compression=bzip2 in the query string of the script's URL.
When done, the script returns an XML document. This document is composed of only one element ExitStatus whose content is a numercal value:
- 0 if the execution has succeeded (the backup file has been generated)
- Any other value if the execution has failed (the backup file has not been generated or it is corrupted)
The backup files generated by the script are SQL dumps that you can import with the MySQL client or with tools like phpMyAdmin. This dump does not drop and recreate the tables, it simply deletes their content and refill them with saved records. Thus, before restoring a backup, you have to ensure that the tables already exist, and that their structure are unchanged.
Because it contains vital information about your MySQL connection, the file ./secure/connect.inc.php should not be accessible to the public. A good pratice would be to deny access to the ./secure directory to anyone.
As many scripts hosted on a web server, the script may be run by anyone if its URL is known. This can be an issue because by running the script repeatedly, an attacker can overwhelm both the disk usage of your web server and the load of your MySQL server.
If you are concerned by this problem, you have the possibility to rename the file dobackup.php and keep its URL secret. Limiting access to the script or its parent directory in the web server's configuration is also an option but the script may become hard to be run as a scheduled task.