[root@amb01 ~]# yum install glib2-devel
mysql-devel zlib-devel pcre-devel openssl-devel cmake
[root@amb01 ~]# tar zxvf mydumper-0.9.1.tar.gz
[root@amb01 ~]# cd mydumper-0.9.1
[root@amb01 mydumper-0.9.1]# cmake .
[root@amb01 mydumper-0.9.1]# make
[root@amb01 mydumper-0.9.1]# make install
[root@amb01 ~]# mydumper -V
mydumper 0.9.1, built against MySQL 5.6.41
[root@amb01 ~]# mydumper --help
-B, --database Database to dump
-T, --tables-list Comma delimited table list to dump
-o, --outputdir Directory to output files to
-c, --compress Compress output files
-m, --no-schemas Do not dump table schemas with the data
-d, --no-data Do not dump table data
-G, --triggers Dump triggers
-E, --events Dump events
-R, --routines Dump stored procedures and functions
-D, --daemon Enable daemon mode
-h, --host The host to connect to
-u, --user Username with privileges to run the dump
-p, --password User password
-P, --port TCP/IP port to connect to
-S, --socket UNIX domain socket file to use for connection
-t, --threads Number of threads to use, default 4
-C, --compress-protocol Use compression on the MySQL connection
-V, --version Show the program version and exit
-v, --verbose Verbosity of output, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2
备份全部数据库:除了information_schema与performance_schema之外的库都会被备份
mydumper -u root -p abcd.1234 -o /home/mysql/backup
备份单个库
mydumper -u root -p abcd.1234 -B tpcc1000 -o /home/mysql/backup
备份单表
mydumper -u root -p abcd.1234 -B tpcc1000 -T customer -o /home/mysql/backup
备份多表
mydumper -u root -p abcd.1234 -B tpcc1000 -T customer,orders -o /home/mysql/backup
只备份表数据不备份表结构
mydumper -u root -p abcd.1234 -B tpcc1000 -T customer -m -o /home/mysql/backup
压缩备份
mydumper -u root -p abcd.1234 -B tpcc1000 -T customer -c -o /home/mysql/backup