• 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.


  • 相关阅读:
    2013面试C++小结
    Linux C 面试题总结 .
    [SCOI2011]糖果
    python——简单爬虫
    python——ADSL拨号程序
    python——处理xls表格
    Vsphere初试——架设Panabit行为管理
    Vsphere初试——使用Vsphere client
    Vsphere初试——基本安装
    Python2与Python3的不同点
  • 原文地址:https://www.cnblogs.com/mmyy-blog/p/11431289.html
Copyright © 2020-2023  润新知