background image

mysql 的 mysqldump 备份

 

MySQLdump 备份数据库

-B, --databases     Dump several databases. Note the difference in usage; in

                    this case no tables are given. All name arguments are

                    regarded as database names. 'USE db_name;' will be

                    included in the output.

-e, --extended-insert

                    Use multiple-row INSERT syntax that include several

                    VALUES lists.  多行插入数据

   为了保证数据的一致性,我们要把表锁起来在 dump

-F, --flush-logs    Flush logs file in server before starting dump. Note that

                    if you dump many databases at once (using the option

                    --databases= or --all-databases), the logs will be

                    flushed for each database dumped. The exception is when

                    using --lock-all-tables or --master-data: in this case

                    the logs will be flushed only once, corresponding to the

                    moment all tables are locked. So if you want your dump

                    and the log flush to happen at the same exact moment you

                    should use --lock-all-tables or --master-data with

                    --flush-logs.              

-x, --lock-all-tables

                    Locks all tables across all databases. This is achieved

                    by taking a global read lock for the duration of the

                    whole dump. Automatically turns --single-transaction and

                    --lock-tables off.

-l, --lock-tables   Lock all tables for read.

--master-data[=#]   This causes the binary log position and filename to be

                    appended to the output. If equal to 1, will print it as a

                    CHANGE MASTER command; if equal to 2, that command will

                    be prefixed with a comment symbol. This option will turn

                    --lock-all-tables on, unless --single-transaction is