Database Back Up and Restore
Control Panel
[home]
User Manual
Contents
If you have not yet customized the software, do that first. See the installation manual BackupRestore_Installation_Manual.html for customization information.
What the Software Does
In essence, the software is used to back up MySQL databases to files that can be used later for restoring the databases. It is especially useful for large databases with more data than the maximum upload built into phpMyAdmin software.
Once logged into the software control panel, you can
-
Back up any/all tables in the MySQL databases you have access to.
-
Optionally download the backup files the software stored on the server.
-
Optionally delete the backup files from the server.
-
When needed, restore MySQL database tables from the backup files.
The backup files are plain text CSV formatted files.
If you wish to view the CSV file or load it into a spreadsheet, the first line of each backup file contains the database name and the table name the file can be restored to.
The second line of the CSV file contains the column names for the backed up table data.
The rest of the CSV file is the table data itself.
Do not edit the backup files unless you know what you are doing. The backup files could become corrupted so they won't restore database tables correctly.
What You Need to Know
You will need to know the host name for your MySQL installation. The host name may be "localhost". Some hosting companies generate their own unique host names for MySQL on shared accounts.
You will need to know the username and the password for each MySQL database you want to back up and/or restore. (Some MySQL databases may have the same username and password as other MySQL databases, or databases may have unique usernames and passwords.)
Knowing the table names within a MySQL database is unnecessary for backing up all tables in a MySQL database. However, if you have a compelling reason to back up only specific tables, the table names will need to be known.
Restoring a MySQL database requires checking the checkbox of every table to be restored.
After Every Backup
After every backup, download the latest backup files to your hard drive. That's because a new backup overwrites the previous backup file.
Use the control panel's "Download" menu item or FTP to download a copy of the backup files. The location of the backup files on the server is the location specified when the software was customized during installation (or changed subsequently).
If the database is corrupted when it is backed up, the backup file is likely to contain the corruption. If the database can not otherwise be repaired, the latest non-corrupted backup file on your hard drive will need to be uploaded to restore the database.
Logging Into the Control Panel
Log in with the username and password specified during at the customization file during the software installation.
If the "Remember me" checkbox is checked when logging in, a cookie will be set to last about 10 years. Otherwise, the cookie will last until the browser is closed.
The browser must accept cookies for successful login. The 10-year cookie when "Remember me" is checked is subject to limiting specifications set in browser preferences.
Control Panel Menu Item "Back Up"
To back up a MySQL database, use the control panel "Back Up" menu item.
To back up the default MySQL database specified in the customization file during the software installation, leave the fields blank.
To back up a MySQL database other than the default, the host name, username, password, and database fields must all have correct information. To back up only specific tables, provide a list of comma-separated table names. If the table field is left blank, all tables of the database will be backed up.
To initiate the backup, click the "Create Backup File(s)" button.
See After Every Backup for important information about what to do after every backup.
Control Panel Menu Item "Download"
To download backup files, use the control panel "Download" menu item.
A list of tables is on the page.
Each table has a "[download]" link. Clicking on it will download the backup file to your hard drive. (It is prudent to do so in case something happens to the backup files on the server.)
In the event you wish to delete one or more backup files from the server, check the files' respective checkboxes then click the "Delete Checked Files" button.
See After Every Backup for important information about what to do after every backup.
Control Panel Menu Item "Restore"
To restore one or more tables of a MySQL database, use the control panel "Restore" menu item.
To restore tables to the default MySQL database specified in the customization file during the software installation, leave the fields blank.
To restore tables to a MySQL database other than the default, the host name, username, and password fields for the database must all have correct information.
A list of databases and their tables with backup files is on the page, each with a checkbox.
Find the database in the list. Check the table names you wish to restore.
To initiate the restoration, click the "Restore Data Backup File(s)" button.
Control Panel Menu Item "Log Out"
When the "Log Out" menu item is clicked, the login cookie is deleted, regardless how long it had been set for.
How Often to Back Up
Databases should be backed up at least once a week, unless the databases don't change at all, such as when they are only read from and not updated.
Any databases that get updated a lot should be backed up daily. Or more often if your situation warrants it.
See After Every Backup for important information about what to do after every backup.
Setting Up a cron Schedule
To automatically make MySQL database backups on a schedule, cron needs to be set up to run the BackupWithCron.php script located in the directory where Database Back Up and Restore is installed.
To set up cron, you'll need to know the server directory location of BackupWithCron.php or its http://... URL.
Click here to reveal instructions how to set up cron with cPanel.
To set up cron with cPanel
Log into cPanel.
Click on the "Cron jobs" icon.
At the Add New Cron Job section, specify the schedule you prefer. There are a lot of options and you can also manually customize the schedule.
Then, specify the command. The command would be (assuming the URL to the BackupWithCron.php script is http://example.com/BackupWithCron.php)
GET http://example.com/BackupWithCron.php
To finalize, click the "Add New Cron Job" button.
If GET... doesn't work (BackupWithCron.php doesn't run), try wget... for the command, like
wget http://example.com/BackupWithCron.php
If wget... doesn't work, there is still one more command to try.
curl http://example.com/BackupWithCron.php
If none of those three versions work, contact your hosting company's support to find out what command to use.
If you do not have cPanel for your hosting account, the way to set up a PHP script for a cron schedule depends on what your hosting company makes available to you.
This article explains several ways: Scheduling PHP URLs With Cron
If none of those work, see the PHP Scripts and Cron article.
Thank You!
Thank you for using this software.
If it doesn't work the way you expected or the way you wish it did, we want to hear about it. Please use our contact form.
Public forum tech support is here.
Will Bontrager
[home]
Database Back Up and Restore,
version 1.0b
Copyright 2012 Will Bontrager Software, LLC