Database Backup

You can take a Database Backup from within the Concrete5 Dashboard, in the Backup Pro module, or through setting up an automated solution such as Cron or Automat:ee (also from mithra62).

The Database Backup has a ton of configuration options, outlined in detail in the Settings area, but the highlights are:

  • Set the backup method (PHP or MySQL)
  • Exclude specific database tables
  • Exclude data from specific tables
  • Inject additional SQL into the backup file
  • Execute arbitrary SQL during the backup process

Automated Backup

To execute the automated backup you'll, basically, either be hitting a URL on a schedule or executing a command from the Console. You can get the specific URL (and example command) for your system from the Cron Backup settings page. Automated backups can be configured to attach the backup to a notification email, customize the notification email, and who the notification email should be sent to upon a successful backup.

Manual Backup

To take a database backup manually you have 2 options; from within the Backup Pro module itself or by selecting Backup Database from the Tools menu. When you initially get to the Backup Database page, you'll have to click Start Backup to begin the process.

Mysqldump Backup Method

For those users interested in database backups using the mysqldump command line utility should use the Mysqldump Backup Method. This method simply uses your hosts command line tool to take your backups which Backup Pro compiles into a singular format. Depending on your needs though this may not be your best option, especially if your data set is large and/or your host doesn't allow command line access.

How It Works

The Mysqldump Backup Method performs a mysqldump backup table by table. Really, the ONLY thing mysqldump is to be used for is compiling the data. The CREATE TABLE statements are still crafted with Backup Pro.

Limitations

Depending on your systems MySQL and mysqldump version, geometry column data could be a problem. Also, mysqldump is notoriously difficult at handling binary data properly. In those instances, the PHP Backup would be a better option.

Also, the backups taken with the Mysqldump Backup Method are NOT compatible with the PHP Restore Method. If you choose this for your Backup Method your only option to restore your database with Backup Pro is with the MySQL Restore Method.

Configuring

When you select the mysqldump Backup Method from the Database Settings page, a new setting will become available where you can set the full path to the mysqldump cool you'd like to use for backups. Be careful NOT to include any connection credentials there; that's all handled by Backup Pro.

PHP Backup Method

If your server is configured to disallow use of the system PHP function, you can still take a database backup using Backup Pro and the PHP Backup Method. The PHP Backup Method is a pure PHP backup solution that doesn't require anything more than what PHP and the mysqli PHP function(s) already allow. Know that depending on how you backup your database can limit your options in regards to native restores wtih Backup Pro and, depending on your system's setup, execution time increases may be required.

How It Works

The PHP Backup Method will inspect each table and uses the table's column type definition to detrmine how to store the data for backup and restoration. It'll also chunk out the data and writes it to a file in order to prevent memory issues, and even have advantages over the Mysqldump Backup Method depending on how you store your data.

Each column of data is inspected to ensure the all strings are UTF-8 encoded and will even create formulaes for any geometry or binary column types you may have.

To help ease any pains from memory limits, the PHP Backup Method chunks up the data to backup into a managable size so you should never have to configure your site for memory limits. Ever.

Limitations

That's not to imply that it's perfect. Due to how the the PHP Backup Method manages memory there's a definite tradeoff in terms of speed. Depending on how much data you have to backup, you may need to configure your PHP installation to allow for a larger execution time. Backup Pro, on its own, will attempt to manage both memory and time limits, but depending on your server configuration it may not be able to so easily.