Backup & Restore your MySQL databases

 

eSuite4X includes a Mac OS X System Preferences pane to manage scheduled tasks and create MySQL backup tasks:

 

System Preferences: Job Control pane

Open Mac OS X System Preferences and click the Job Control icon in the Other section to display the eSuite4X Job Control pane.

     
 

Control your Cron jobs

The Job List displays the cron jobs for your current user. Cron is a Unix system utility to schedule jobs and is included with Mac OS X. The eSuite4X Job Control pane is a graphical interface to make using the cron utility as easy as possible. If you want to know more about the cron utility enter "man cron" or "man crontab" in a terminal window.

Cron usually starts automatically on system startup and checks every minute if there is a task to be executed. This means cron runs your tasks only if your system is running during the specified execution time of a task. If your system is down, all tasks scheduled for execution while your system is down will be skipped without further notice.

 

     
 

Create a MySQL Backup Job

To create a MySQL Backup Job click "Backup DB...". The mysqldump config sheet is displayed. Please specify the following mandatory settings:


Save Backup to File  

Specify the path to the backup file. The backup file will be created if it does not exist. If the file already exists it will be replaced.

The default setting for your backup file is:

$HOME/Documents/`date "+dump-\%y\%m\%d-\%H\%M\%S.sql"`

This term creates a new file for each backup in <your-users-home>/Documents. The file name of each backup file starts with dump followed by a date/time signature. If you run the backup on April 5, 2003 at midnight the following file will be created:

..../Documents/dump-030405-000000.sql

Usually you don't need to modify the default file name.

     
Database Server   Specify the IP Address or the Internet name of your database server. You can backup local and remote database servers.
     
Database  

If you want to back up a specific database you can enter the name of the database here. To back up more than one database list the names of all databases separated by a space.

Leave this field empty if you want to back up all databases available at the specified database server.

     
Login User Name   MySQL user name to login for the backup
     
Login Password  

MySQL password to login for the backup.

ATTENTION: The password will be saved unencoded in the Mac OS X crontab database.


 

Click "Create MySQL Backup Job" to close the sheet. The new job is now listed in the job list, but is not yet activated.

 

Scheduling the Backup Job

Before activating the job you should change the execution schedule. The default settings after creating your job executes the backup every midnight, 7 days a week. If you want to change the time for the backup execution simply change the values in the MINUTE and HOUR column for this task.


Column   Allowed values
MINUTE   0-59
HOUR   0-23
DAY (Day of Month)   1-31
DoW (Day of Week)   0-7 (0 or 7 is Sunday)
MONTH   1-12

 

Activate your new Backup Job

To save and activate the new Backup Job click "Activate Now!". This passes all jobs and schedules listed in the Job List to the Mac OS X cron system for execution.

If you want to do a test run before activating a job click "Run Job Now!" after selecting the job in the Job List.

 

 

 

Restore your database

The Job Control Pane uses mysqldump to create the backup files. The created backup files are text files with a list of SQL commands. To restore your database from the backup file you have to execute the created SQL command file with any processing engine for MySQL scripts (ie. the mysql command line interface/CLI or the SQL Console of SQL4X Manager J).

The created backup files are system independant. This means you can restore your backup file on any system you like, even a Linux or Windows system.