美文网首页
MySQL对比同步表结构

MySQL对比同步表结构

作者: 袁先生的笔记 | 来源:发表于2021-09-01 15:02 被阅读0次

    安装mysqldiff

    yum install -y mysql-utilities
    

    对比

    • 对比库
    mysqldiff --server1=user:pass@10.0.0.1:3306 --server2=user:pass@10.0.0.2:3306 db1:db2
    
    • 对比表
    mysqldiff --server1=user:pass@10.0.0.1:3306 --server2=user:pass@10.0.0.2:3306 db1.table1:db2.table1
    
    • 常用参数
      --skip-table-options  skip check of all table options (e.g., AUTO_INCREMENT,
                            ENGINE, CHARSET, etc.).
    
      -d DIFFTYPE, --difftype=DIFFTYPE
                            display differences in context format in one of the
                            following formats: [unified|context|differ|sql]
                            (default: unified).
    
      --show-reverse        produce a transformation report containing the SQL
                            statements to transform the object definitions
                            specified in reverse. For example if --changes-for is
                            set to server1, also generate the transformation for
                            server2. Note: the reverse changes are annotated and
                            marked as comments.
    

    相关文章

      网友评论

          本文标题:MySQL对比同步表结构

          本文链接:https://www.haomeiwen.com/subject/vuixwltx.html