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](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
mysqlfrm 可以抽取frm文件里面的表结构
mysqlfrm 有两种操作模式。默认的模式是再生个实例,使用--basedir选项或指定--server选项来连接到已经安装的实例。这种过程不会改变原始的.frm文件。
该模式也需要指定--port选项来给再生的实例使用,该端口不能与现有的实例冲突。在读取.frm文件后,再生的实例将被关闭,所有的临时文件将被删除的。
另一个模式是诊断模式,--diagnostic 选项。byte-by-byte读取.frm文件 尽可能多的恢复信息。该模式有更多的局限性,不能校验字符集。
当使用默认模式无法读取文件或者该服务器上没有安装MySQL实例就使用诊断模式。
[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;
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。