Frequently Asked Questions
Search:     Advanced search
Browse by category:

KB267: Backing Up a MySQL Database using Attix5 Backup Professional SE and scripting

Views: 285
Votes: 1
Posted: 08 Jan, 2010
by: Van Rensburg J.
Updated: 08 Jan, 2010
by: Van Rensburg J.
Backing up MySQL requires the user to dump the data to file using the mysqldump utility.

This utility can be run on both Linux and Windows, with minimal installation of additional third-party tools.

Linux
Install Attix5 Backup Professional as normal, then install “script_plugin.jar” into the plugins directory.

You need to create a script file to call the mysqldump utility with the correct parameters.

For example:
Create a text file called “a5mysqldump.pl”

Set the file to be executable with “chmod a+x a5mysqldump.pl”

Open the file using your favourite text editor, and enter the following lines, substituting username, password, and database as appropriate:

#!/usr/bin/perl

exec "mysqldump --opt -h hostname -u username --password=password database |gzip > /home/user/testMySQLdump/testdump.gz";

NOTE:  There are only two lines to this script, the second line may be wrapped by your document viewer.

Save the script to a location which the user running the a5backupd service can read. (Usually, this is root, so anywhere will be readable – I used the /home/user/ directory).

Open the a5backup-gui, and select “Tools->Plugins->Scripting”.

Add a new script.

Select a name for script, and set the script to run on “Backup start”.

In the “Execute” field, enter the full file path of the script. So, for our example enter “/home/user/a5mysqldump.pl”

In the “Execute in folder” field, enter the filepath of the script file. In our example this is “/home/user/”.

Tick the “Wait for process to complete” checkbox., then click “OK”, then “OK” again to return to the user interface.

Find the dump file directory, and select the database dump file or folder for backing up (if a dump file does not yet exist, either run the script separately from command prompt, or start and abort a backup after the script runs).

Click on “Backup” to start the backup process.  The database should be dumped, then the file backed up.

Windows
Install the script plugin using the plugin installer.

Next create a directory where the dump files will be dumped to, eg C:\MySQLdump\

Next, you need to create a batch file to call mysqldump with the correct parameters.

Open notepad, and enter the following,

mysqldump --opt -h hostname -u user --password=password database > C:\MySQLdump\testdump.txt

NOTE: The above text is a single line, which may be wrapped by your document viewer.

Save the batch file into your Attix 5 Backup Professional installation directory as a “.bat” file (in this example, A5MySQLDump.bat was used).

In the Backup Professional user interface, go to “Tools->Plugins->Scripting”.

Add a new script.

 

Select a name for script, and set the script to run on “Backup start”.

In the “Execute” field, enter the full file path of the script. So, for our example enter “C:\Program Files\Attix5 Backup Professional SE\A5MySQLDump.bat”

In the “Execute in folder” field, enter the filepath of the “mysqldump” executable, which is the bin directory for MySQL. In our example this is “C:\Program Files\MySQL\MySQL Server 5.0\bin\”.

Tick the “Wait for process to complete” checkbox., then click “OK”, then “OK” again to return to the user interface.

Find the dump file directory, and select the database dump file or the folder for backing up (if a dump file does not yet exist, either run the script separately from command prompt, or start and abort a backup after the script runs).

Click on “Backup” to start the backup process.  The database should be dumped, then the file backed up.

Others in this Category
document KB003 - How do I increase the Virtual Memory for SE on a Novell NetWare server?
document KB005 - How to change the default service port
document KB016: Server Edition on Novell NetWare installation tips
document KB020: Server Edition memory on Linux
document KB022: Changing memory in Windows Server Edition
document KB024: Server Edition service won't start
document KB025: How to export the SE display from Linux to Windows Desktop (Xming or Cygwin)
document KB028: Backing up mapped drives with Server Edition
document KB032: Run Server Edition in debug mode
document KB036: ddraw.dll problem
document KB045: What to do with incomplete log files
document KB049: Windows NT Server rasman.dll error
document KB050: Manual dialup on Server Edition using script plugin
document KB051: Error when upgrading SE: 'Could not create file SERunner.exe'
document KB053: Backup encrypted files
document KB056: Disable SERunner (system tray icon)
document KB065: CRC errors on FileServer / file length zero after write
document KB066: Problem with SMSUT.NLM
document KB068: Upgrade Server Edition on Novell NetWare
document KB069: Negative dates during restore
document KB073: UNC for Windows and NetWare
document KB074: Server Edition Access Security
document KB078: Skipped Files: "The system cannot find the path specified"
document KB080: Database Locked errors
document KB083: Backing up network volumes
document KB084: What do the Processor Usage and Disk Access sliders in SE mean?
document KB089: Could not create backup: The device is not ready
document KB109: VSS and Long Filenames
document KB113: Install tips for LINUX platforms
document KB114: SE v4.1.16 does not auto-update
document KB122: "Could not create Java virtual machine"
document KB123: TSJNI.NLM NetWare restore error message
document KB125: NetWare client trying to access \etc
document KB129: Conflict between actual Backup Size and Size function in GUI
document KB133: Unable to install SE after system state restore
document KB135: Clearing of cache in SE on WinXP is slow
document KB138: SCO libnio.so linker problem, service dies on backup
document KB163: Server Edition on Unix and SAMBA - skipped files
document KB180: Out of memory problems during delta blocking
document KB183: Auto-upgrade SE V5.0.0.199 / V5.0.1.1 to V5.0.2.8
document KB184: Manually upgrade SE V5.0.x to V5.0.2.8
document KB188: Cache update problem with Exchange 2007 and Exchange plugin
document KB189: How to recover a single Exchange 2003 mailbox without using the Exchange or SMR plug-ins
document KB192: Insufficient system resources exist to complete the requested service
document KB194: SMR gives 'Invoke of: GetObject' error during backup after upgrade to v5
document KB196: 64bit Linux failed dependencies: rtld(GNU_HASH)
document KB197: Email Notification fails to send test message with v5 SE.
document KB199: VSS Restores always overwrites original data
document KB215: VSS problems on V5 SE and Windows Server 2003 (mostly cache related)
document KB230: Run the SE or D&L GUI in test mode
document KB236: SQL backup fails with warning "A parallel operation cannot be started from a DAC connection."
document KB237: How to recover a single Exchange 2007 mailbox using Recovery Storage Group
document KB243: Large Exchange patches when delta blocking is used
document KB256: Unable to open Options in Server Edition



RSS