The doBackup.sh Shell script was created to help MySQL Administrators automate the backups of their MySQL Databases. You can setup a single database in the script to just have the script backup that database every time it runs or you can pass the database name to the script and backup that database.
Either way you can setup this script in cron to backup the database on a regular basis. In Addition, there is an option to mount to a network drive and also have the database copied to that network drive. This can be setup in the settings or you can pass a parameter to the script to tell it to execute the net copy function.
NOTE: There are some settings in the script that you will have to setup in the code, Please see the settings sections for more details
Switch | Description |
---|---|
-d databasename | The Database Name that you want to backup |
-n | Enable the Network Drive Backup |
Setting | Description |
---|---|
username | Default MySQL Username that has access to the database(es) |
password | Default MySQL User Password |
targetPath | Default Target Path to copy the database to |
targetDatabase | Default MySQL Database to use. |
net_User | Optional if Using Copy to NetDrive option, Default Network Share Username |
net_Password | Optional if Using Copy to NetDrive option, Default Network Share Username Password |
net_MapPath | Optional if Using Copy to NetDrive option, Default Path to network share //server/sharepath |
net_MapTo | Optional if Using Copy to NetDrive option, Local Drive to map the network share to |
mapNet | You can use the switch to override this, but you can enable or disable the copy to network share as a default. |
deleteAfterNetCopy | If enabled, then it will delete the local copy of the backup after it has been copied to the network drive. |