签到成功

知道了

CNDBA社区CNDBA社区

mysqldump命令详解 --master-data参数的使用

2021-12-04 19:01 3084 0 原创 mysql
作者: hbhe0316
  --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
                      specified too (in which case a global read lock is only
                      taken a short time at the beginning of the dump; don't
                      forget to read about --single-transaction below). In all
                      cases, any action on logs will happen at the exact moment
                      of the dump. Option automatically turns --lock-tables
                      off.
  --max-allowed-packet=#

If the option value is 2, the CHANGE MASTER TO statement is written as an SQL comment, and thus is informative only; it has no effect when the dump file is reloaded.
If the option value is 1, the statement is not written as a comment and takes effect when the dump file is reloaded.
If no option value is specified, the default value is 1.
如果选项赋值为2,那么CHANGE MASTER TO 语句会被写成一个SQL comment(注释),从而只提供信息;
如果选项赋值为1,那么语句不会被写成注释并且在dump被载入时生效。
如果没有指定,默认值为1。http://www.cndba.cn/hbhe0316/article/22702

[root@mysql57 data]# mysqldump -h127.0.0.1 -uroot -pwwwwww --single-transaction --set-gtid-purged=OFF  --databases testdb  --master-data=1   --triggers --events --routines> /tmp/testdb1_all_master.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

http://www.cndba.cn/hbhe0316/article/22702http://www.cndba.cn/hbhe0316/article/22702

http://www.cndba.cn/hbhe0316/article/22702
http://www.cndba.cn/hbhe0316/article/22702http://www.cndba.cn/hbhe0316/article/22702

[root@mysql57 data]# mysqldump -h127.0.0.1 -uroot -pwwwwww --single-transaction --set-gtid-purged=OFF  --databases test  --master-data=2   --triggers --events --routines> /tmp/test_all_master.sql

http://www.cndba.cn/hbhe0316/article/22702http://www.cndba.cn/hbhe0316/article/22702http://www.cndba.cn/hbhe0316/article/22702

http://www.cndba.cn/hbhe0316/article/22702

版权声明:本文为博主原创文章,未经博主允许不得转载。

MYSQL

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:2767895次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ