zoukankan      html  css  js  c++  java
  • mysql的一个工具 mysql-utilities

    mysql-utilities是mysql的一个工具集合,它是基于----- python2 --- 实现的,从官网查看到最新版本为mysql-utilities-1.6.5.tar.gz
    编译安装
        wget https://cdn.mysql.com/archives/mysql-utilities/mysql-utilities-1.6.5.tar.gz
        tar xvf mysql-utilities-1.6.5.tar.gz
       cd mysql-utilities-1.6.5
       python setup.py build
       python setup.py install
       mysqldiff --version

    1 mysqlfrm 可以抽取frm文件里面的表结构
    mysqlfrm 有两种操作模式。默认的模式是再生个实例,使用--basedir选项或指定--server选项来连接到已经安装的实例。这种过程不会改变原始的.frm文件。
    该模式也需要指定--port选项来给再生的实例使用,该端口不能与现有的实例冲突。在读取.frm文件后,再生的实例将被关闭,所有的临时文件将被删除的。 另一个模式是诊断模式,--diagnostic 选项。byte-by-byte读取.frm文件 尽可能多的恢复信息。该模式有更多的局限性,不能校验字符集。 当使用默认模式无法读取文件或者该服务器上没有安装MySQL实例就使用诊断模式。
    #
    /tmp/backup/2019-08-27_17-32-55/dstdata 是通过innodbbackupex备份的目录,first是其中的一个表

    [root@localhost mysql-utilities-1.6.5]# mysqlfrm --diagnostic /tmp/backup/2019-08-27_17-32-55/dstdata/first.frm
     # WARNING: Cannot generate character set or collation names without the --server option. # CAUTION: The diagnostic mode is a best-effort parse of the .frm file. 
    As such, it may not identify all of the components of the table correctly.
    This is especially true for damaged files. It will also not read the default values for the columns and the resulting statement may not be syntactically correct.
    # Reading .frm file for /tmp/backup/2019-08-27_17-32-55/dstdata/first.frm: # The .frm file is a TABLE. # CREATE TABLE Statement: CREATE TABLE `dstdata`.`first` ( `id` int(11) DEFAULT NULL, `name` char(16) DEFAULT NULL ) ENGINE=InnoDB; #...done.


  • 相关阅读:
    CentOS 7安装Splunk
    OpenSwitch操作系统成为Linux基金会官方项目
    新手选择使用 Linux 桌面的七个注意点
    SELinux入门
    新一代 Tor发布,它牛在哪里?
    【光环国际】一位老太太的需求
    【情商】为人处世
    【Teradata】磁盘碎片整理(ferret工具)
    【架构解密】第六章 深入解析分布式存储
    【大数据技术】HBase Meetup资料
  • 原文地址:https://www.cnblogs.com/mmyy-blog/p/11431289.html
Copyright © 2011-2022 走看看