833 - ESE backup script example: MySQL database dump

Modified on Mon, 21 Jul at 12:54 PM

 

An example of a MySQL database dump backup is described below.

Requirements

  • MySQL server installation, including mysqldump.exe
  • Some dump space on disk that needs to be included in the selection.
  • Permission to write to the dump location. This may need to be explicitly granted to the Redstor Pro service user.
  • A user with sufficient rights to backup MySQL.

 

1. Create a batch file containing the following:

cd <path to MySQL bin folder>
mysqldump --opt -h <hostname> -u <user> --password=<password> <database name> > <dump path out>

  • For example, if backing up "Engineering" to C:\MySQLDump\Engineering.txt using the username "redstor" and password "Password123":

cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
mysqldump --opt -h localhost -u redstor --password=Password123 engineering > C:\MySQLdump\engineering.txt

  • Should you wish to backup multiple databases, these can be specified by repeating the "mysqldump" command with different database names and filenames. For example:

mysqldump --opt -h localhost -u redstor --password=Password123 finance > C:\MySQLdump\finance.txt

Note: Use a static filename for dumped MySQL backup files (.txt in the examples above), so that files will be patched and not added as new files.

2. Test the backup script from the command line before adding it to the Agent for execution.

3. Configure the script in the Agent to run before each backup.

backupscriptsbefore.PNG

4. Add the script to the backup selection. Ensure via the UI that the dump location is included in the backup selection.

mysqldump_included.PNG

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article