4. Backup MySQL DB to directory

Basic ini file

 1 ;;; we want to backup selected databases on server
 2 storage.mysql.dbname = testdb
 3 
 4 ;;; connect to mysql server
 5 storage.mysql.host = localhost
 6 storage.mysql.port = 3306
 7 storage.mysql.user = root
 8 storage.mysql.password =
 9 
10 ;;; configure rotation schema
11 storage.mysql.rotate.days = 7
12 storage.mysql.rotate.weeks = 4
13 storage.mysql.rotate.months = 3
14 
15 ;;; configure rotation schema specifics for database
16 storage.mysql.dbname.testdb.rotate.days = 2
17 storage.mysql.dbname.testdb.rotate.weeks = 0
18 storage.mysql.dbname.testdb.rotate.months = 0
19 
20 ;;; databases will be backed up under this folder change as required
21 storage.mysql.basedir = "~/Backups"
22 
23 storage.dummy =
24 
25 compare.sqlite.file="~/Backups/xtbackupCompare.db"
26 
27 ;;; let us put everything together
28 engine.outputs[]=cli
29 engine.local=mysql
30 engine.remote=dummy
31 engine.compare=sqlite

line 2: we specify name of DB we want to backup see examples below for multiple/all DBs settings

lines 5-8: set mysql connection details

lines 11-13: set value to storage.mysql.rotate.days to define for how many days should backups be kept same logic applies for weeks and months

line 23: we don't want to move the files to other backup storage, so we use dummy driver

line 25: new need to set compare service, we use sqlite version(only one implemented at the time of writing this)

All Databases backup - example ini file

Same as basic example, but we specify that we want to backup all DBs

;;; we want to backup all databases on server
storage.mysql.dbname = *

Multiple Databases - example ini file

1 ;;; we want to backup only DBs named "mysql" and "test"
2 storage.mysql.dbname[] = mysql
3 storage.mysql.dbname.test.compressdata = true
4 storage.mysql.dbname.test.addtobasedir = test

lines 3-4: if you want to specify parameters for individual DBs you can use this type of syntax