Protecting MySQL Databases

Protecting MySQL Databases

You can protect MySQL databases by using native tools to create a backup dump file or by configuring a pre-execute script on the Barracuda Backup Agent.

Create a Batch File

Use the mysqldump command to create a MySQL database dump file.

Here is the syntax to create the batch file:

cd\
cd "<path-to-mysql-server-location>"
mysql -u <privileged_account> -p -c -B mysqldump.exe <database_name> > <path-to-location-to-dump-the-database><name-of-script>

An example of how to create a batch file using the mysqldump command:

  1. Verify the Barracuda Backup Agent is installed on all systems to be backed up.

  2. Open a text editor, for example Notepad, and type the following lines:
    cd\
    cd "Program Files (x86)\MySQL\MySQL Server 5.6\bin"
    mysql -u root -p -c -B mysqldump.exe database_name > c:\temp\dump.sql

  3. Save the text file as a batch (.bat) file:

    batch_file01.png

     

     

Configure Agent to Run the Pre-Execute Script

You can pre-execute your batch file prior to running a backup.

Here is the syntax to edit the [configuration] section in the config.ini file:

[configuration]  
# Comment 
preExecuteScript=<path-to-backup-agent><name-of-script>

Use the following steps to modify the config.ini file:

  1. Open the Services console. Right-click the Barracuda Backup Agent service, and click Stop.

  2. Navigate to the config.ini file on the server:

    C:\Program Files\Barracuda\Barracuda Backup Agent\config\

  3. Open the config.ini file in a text editor, and in the [configuration] section, enter the following lines:
    # Batch file to backup mysql database
    preExecuteScript="C:\mysqlbk.bat"

  4. Save and close the file. 


We value your feedback.
If you have questions, suggestions, or feedback on our documentation, contact the Campus Product Documentation team.
For general product inquiries or technical support, please contact the global Barracuda Support team.