Backing Up MySQL Databases

Follow

MySQL databases are prevalent across many Linux distributions. It is possible to back them up through JAMSAgentX.

Creating the Job
To start, click the Jobs button on the sidebar under Definitions to create a new job. Name it something such as MySQL Backup. Choose the Execution Method SSHAgent.
The Username chosen should be the one that connects to the Linux node. The following example could be utilized for the Source:

#!/bin/bash

mysqldump -u <<user>> -p<<password>> --all-databases | gzip > <<direc>>/backup_`date '+%m-%d-%Y'`.sql.gz

After manipulating any other Job Properties, toggle the Checkbox to edit the Job definition after adding. Here, go to the Parameters tab and click Add on the bottom. The first parameter will be user, insert it as shown:



The data type is simply Text.  The next parameter is password, and is entered as follows:


Again, the data type is Text. The last parameter is direc, and is entered as such:

The data type is Text for this as well.  Click the Save button to finish.Submitting the Job
Now that the job has been created, it is time to submit it. Click the Submit button and a dialog box with the parameters will come up.

The User field is for the name of the MySQL user that has control of the databases. The Password field is for the password of this MySQL user. The Output Directory defines where the backup file will be located on the remote node. Note that the directory chosen must be writable by the SSH user that chooses to execute the job. In this example, the SSH user is mvp, so the output directory of ~/backups will direct the backup file to /home/mvp/backups.

The script in this job could be changed to backup just certain databases, specific tables, etc. This gives users a general understanding of how MySQL databases can be backed up through JAMS.

Have more questions? Submit a request

Comments