# Backup & Export MariaDB servers

The “mdump.sh” wrapper script for MariaDB dumps is launched with following option to ensure all the database are backed up in the textual backup:

```sql
-all-databases --lock-all-tables --flush-logs --master-data=2 --routines
```

The executions of “mdump.sh” or “mbackup.sh” requires a configuration file, which contains the following parameters.

The script requires command lines argument in addition to the configuration file. Some of the configuration file parameters are also available in command-line. The parameters given in command line are from higher priority compared to their configuration values. Which allow different behave using the same configuration file.

Example:

```bash
mdump.sh –s ${MYSQL_SERVER}
```

```bash
mbackup.sh –s ${MYSQL_SERVER}
```

## Parameters

A hyphen character prefixes the command line parameters as they are be used within a shell.

### –h or –help

Display the Synopsis.

### –s or -–sid

The target database on which, the MariaDB dump or backup operation should be launched. This parameter is always required.

```bash
{mdump|mbackup}.sh –s ${MYSQL_SERVER}
```

### –c or –-configfile

:information\_source:The dbi services best practice consist of saving the configuration file under the database admin directory which makes the command-line parameter “ConfigFile” useless

```bash
cp ${DMK_HOME}/templates/{mdump|mbackup}.cfg \\ 
${DMK_MYSQL_ADMIN}/etc/{mdump|mbackup}.cfg
```

Otherwise the command-line parameter becomes mandatory

```bash
{mdump|mbackup}.sh –s ${MSQL_SERVER} –c <path to the configuration file>
```

### –d or –-databasename

Optional parameter if you want to backup only one specific database.

```bash
{mdump|mbackup}.sh –s ${MSQL_SERVER} –d <database_name>
```

### a or --alldatabasessinglefiles

Optional parameter if you want to have a separated backup file per database.

```bash
{mdump|mbackup}.sh –s ${MSQL_SERVER} –a
```

### BckPath or DumpPath

:information\_source: The DumpPath parameter belongs to the MariaDB dump script “mdump.sh”

```bash
#*************************************************************
# DumpPath
# MySQL dump destination
# Default is : "" - $DMK_MYSQL_ADMIN/backup
DumpPath=""
```

:information\_source: The bckPath parameter belongs to the MariaDB backup script “mbackup.sh”. This script creates automatically a sub-folder for each execution (the folder name contains the start data of the backup)

```bash
#*************************************************************
# BckPath
# MySQL backup destination
# Default is : "" - $DMK_MYSQL_ADMIN/backup
BckPath=""
```

:warning: If the backup or dump directory doesn’t exist, the MariaDB operation will abort!

### LogPath

```bash
#*************************************************************
# LogPath
# Destination of the log files
# Default is : "" - $DMK_MYSQL_ADMIN/log
LogPath=""
```

### Compress

:information\_source: The compress option is only available for the MariaDB dump script “mdump.sh”

```bash
#*************************************************************
# Commandline : --compress or -z
# Compression using
# Default is : "0" - non compressed
Compress=""
```

### PreScript

```bash
#*************************************************************
# Launch a pre Export script
# the logfile is written under log_path
# Default is : ""
PreScript=""
```

### PostScript

```bash
#*************************************************************
# Launch a post Export script
# the logfile is written under log_path
# Default is : ""
PostScript=""
```

### Customer

```bash
#*************************************************************
# Name/ShortName of the customer
# Default is : "dbi-services"
Customer=""
```

### NoSuccessMail

```bash
#*************************************************************
# NoSuccessMail
# Default is : "0" -means the sucessmail will be sent
NoSuccessMail="0"
```

### MailRecipients

```bash
#*************************************************************
# MailRecipients
# comma separated list of mail recipients
# Default is : "" - empty
MailRecipients="”
```

### SmtpServer

```bash
#*************************************************************
# SmtpServer
# Infrastructure SMTP server
# Default is : "" - localhost
SmtpServer=""
```

### MailFrom

```bash
#*************************************************************
# MailFrom
# Hardcode address From sender
# Default is : "" - ${USERNAME}.${HOSTNAME}@${DOMAIN}
MailFrom=""
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dbi-services.gitbook.io/dmk-mariadb-manual/servers-management/backup-and-export-mariadb-servers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
