I need your help in configuring mysqldump in order to automatically download backups from one server to an external disk in a fixed time (Everyday at 6:00 Pm). If mysqldump is unable to do that, can your suggest another software?
You can use your operating system's scheduler to automatically run the mysqldump
command at your desired times, eg cron
on Linux and the Task Scheduler on Windows.
To have mysqldump
write to the external disk, you can mount the disk so the destination path is reachable to mysqldump
and use it in the output path. To specify the output path, you can either use >
redirection or the --result-file
option.
Both approaches work on Linux/Unix but this distinction is important for Windows where redirection won't work properly using PowerShell. This is because redirection on PowerShell produces UTF-16
using redirection which cannot be read. The --result-file
option will provide ASCII
output that can be read.
Windows Examples
C:\> mysqldump.exe –e –u[username] -p[password] -h[hostname] [dbname] > [C:\path\to\mybackup.sql]
C:\> mysqldump.exe –e –u[username] -p[password] -h[hostname] [dbname] --result-file [C:\path\to\mybackup.sql]
Linux/Unix Examples
# mysqldump -u[username] -p[password] -h[hostname] [dbname] > [/path/to/mybackup.sql]
# mysqldump -u[username] -p[password] -h[hostname] [dbname] --result-file [/path/to/mybackup.sql]
More information is available here:
Depending on your backup requirements, you may also want to consider other options such as Percona XtraBackup , LVM snapshots (eg mylvmbackup ), etc. This Percona XtraBackup presentation has a comparison table on slide 3.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.