1, Usage
mysqldump -uroot -p --databases test > /home/test.dump
2. Parameter Description
-uroot: a database user called root
-h172.16.43.131: Specifies the IP address of the mysql database
-p: set parameters
--databases test: set export database for test, can simultaneously export multiple libraries, library name separated by a space, such as --databases test1 test2, you can also export all the libraries, using the --all-databases parameters
--single-transaction: set the transaction isolation level is repeatable read, guarantee period dump, other threads will not affect the data submitted does not lock the table this data, during the change
--lock-all-tables: lock all the tables, the relative --single-transaction, during the dump, other threads can not submit data (default policy)
--no-data: data is not backed up, the backup database structure only
--set-gtid-purged = off: off global transaction ID (GTID)
--max_allowed_packet = 512M: max_allowed_packet size setting, the value is preferably equal to the size my.conf configuration, there would Got packet bigger than 'max_allowed_packet' bytes when dumping table `xxx` at row: 3540 Error
3, compressed backup
mysqldump -uroot -p --databases test | gzip > /home/test.dump.zip