Database Back Up and Restore
Installation Manual
 
 

Installation Manual

Click here for the software description page.

Overview

Database Back Up and Restore is used to back up MySQL databases and restore them.

Decompress the download package. See the files list below.

Then, proceed with the "Customization" and "Installation" sections.

Files List

These files are included in the download package:

README.txt
BackupRestore_Installation_Manual.html
BackupRestoreCustom.php
BackupRestoreManual.html
BackupWithCron.php
BackupRestore.php

Database Back Up and Restore does not itself use MySQL for storing customization preferences. Therefore, all customization preferences are specified in the BackupRestoreCustom.php file.

When the file has been customized, installation can proceed. See the "Customization" and "Installation" sections.

Customization

The file BackupRestoreCustom.php needs to be customized.

It's a plain text file. To edit, open the file in a plain text processor like NotePad or TextWrangler.

The customization file has 4 sections:

  1. Control Panel
  2. Backup Directory
  3. Default MySQL Credentials
  4. Scheduled Backup With cron

~ Control Panel section

Specify the username and password for logging into the Database Back Up and Restore control panel. Example:

$LoginUsername = "cpUsername";
$LoginPassword = "cpPassword";

Either or both the username and password may contain embedded space characters. "Embedded" means within the username or password but not at the beginning or end.

~ Backup Directory section

Specify the directory where the backup files shall be stored. Specify the directory the way it is most comfortable for you. It may be specified as:

Database Back Up and Restore will try to create the directory and give it correct permissions. If it can not (depends on how your server is configured), It will tell you what to do when you access the control panel.

Example specification:

$BackupFilesDirectory = "/installed/backup";

~ Default MySQL Credentials section

Specifying default MySQL credentials is optional.

An advantage is that you don't have to type them in whenever you want to back up a database or restore a table. Another advantage is if you don't have Database Back Up and Restore at a secure https:// URL, then the default credentials don't have to be transmitted for them to be used.

To specify default credentials, you'll need to know the host name, username, password, and database name to specify as default. Optionally, table names may also be specified.

The backup and restore sections require the host name, the username, and the password. You'll see where to type them in the BackupRestoreCustom.php file. Example:

$Hostname = "localhost";
$Username = "myUsername";
$Password = "myPassword";

The backup section requires, in addition to the above, the database name. You'll see where to type it in. Example:

$Database = "databaseName";

Default MySQL table names may also be specified at the backup section. If the table names are left blank for the default credentials, all tables will be backed up. Example:

$Database = "databaseName";
$Tables = "";

If table names are specified, they need to be specified with a comma (and optional space) separating each table name. If any table names are specified for the default credentials, only the listed tables will be backed up. Example:

$Database = "databaseName";
$Tables = "table1, table2, table3";



The default credentials are used only when a backup or restore is done via the control panel and not all necessary credentials are provided.

If all necessary credentials are provided in the control panel, then the default credentials are overridden.

~ Scheduled Backup With cron section

A cron schedule can be set up to automatically make backup files.

Two things need to be done to set up a cron schedule for backing up MySQL databases.

  1. Customize the "Scheduled Backup With cron" section so Database Back Up and Restore knows what to do when it is launched with cron.

  2. Cron itself needs to be set up. See the user manual in the Database Back Up and Restore control panel for information about how to set up cron.

In the "Scheduled Backup With cron" section, specify the username, password, and database name to back up. More than one username/password/database set may be specified to automatically back up more than one MySQL database. Each set is a directive. Table names may be included in a directive.

In the BackupRestoreCustom.php file, you'll find two lines that contain the word "MARK". Between those two lines is where the directives will be typed.

The username, password, and database name in a directive are separated with a comma, on one line. Example:

$cronBackup = <<<MARK
username,password,database
MARK;

Space characters before or after the commas are optional. There may be blank lines within the area bounded by the "MARK" lines. Example:

$cronBackup = <<<MARK

username, password, database

MARK;

A directive may also include table names. (When no table names are specified, all tables in the database is assumed.) Example:

$cronBackup = <<<MARK

username, password, database, table1, table2, table3

MARK;

More than one directive may be specified. Example:

$cronBackup = <<<MARK
username, password, database, table1, table2, table3
username2, password2, database2
username3, password3, database3, tablename
username4, password4, database4
MARK;

The user manual has information about setting up a cron schedule. When cron runs, Database Back Up and Restore processes the directives specified in the BackupRestoreCustom.php file.

NOTE: The Database Back Up and Restore control panel must be logged in at least once before a cron backup will be successful. That's because the control panel is associated with creating the subdirectory where the backup files are stored.

~ Getting an email when a scheduled backup runs

In the BackupRestoreCustom.php file, you'll see two variables, $EmailAddress and $EmailSubject - something like this:

$EmailAddress = "will@example.com";
$EmailSubject = "[backup] MySQL";

If you wish to receive an email whenever a cron scheduled backup is completed, specify the email address for the $EmailAddress value. Otherwise, leave it blank.

The $EmailSubject value can be used to specify a subject line for the email.

Installation

To install, decide which subdirectory Database Back Up and Restore will be installed in. The subdirectory needs to be accessible with a browser.

For best security, if it is available, install Database Back Up and Restore to a secure server and run the software with an https://... URL.

Upload these files into the installation subdirectory.

BackupRestoreCustom.php
BackupRestoreManual.html
BackupWithCron.php
BackupRestore.php

Once uploaded, type the URL of BackupRestore.php into your browser's address bar. BackupRestore.php is the Database Back Up and Restore control panel.

Once in the control panel and its home page is loaded, click the "User Manual" menu item to become familiar with how to use Database Back Up and Restore.

Thank You!

Thank you for using Database Back Up and Restore.

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.

signature

Will Bontrager

Copyright 2012 Will Bontrager Software, LLC