mysql linux .frm位置_linux 使用mysqlfrm

【1】下载安装

【1.1】下载

linux:wget https://downloads.mysql.com/archives/get/p/30/file/mysql-utilities-1.6.5.tar.gz

【1.2】二进制编辑安装

48304ba5e6f9fe08f3fa1abda7d326ab.png

#前置条件,python2.6及以上

tar -xvzf mysql-utilities-1.6.5.tar.gz

cd mysql-utilities-1.6.5python ./setup.py build

python ./setup.py install

48304ba5e6f9fe08f3fa1abda7d326ab.png

【1.3】检查是否安装好

mysqlfrm --version

【2】参数介绍与使用

【2.1】参数介绍

48304ba5e6f9fe08f3fa1abda7d326ab.png

--basedir :如 --basedir=/usr/local/percona-5.6.21

--server : 如 --server=user:password@192.168.1.100:3306

--diagnostic : 开启按字节模式来恢复frm结构--user :启动MySQL用户,通过为mysql

48304ba5e6f9fe08f3fa1abda7d326ab.png

【2.2】使用 --basedir 模式

(1)mysqlfrm --basedir=/usr/local/percona-5.6.21/ /root/t1.frm --port=3434 --user=mysql --diagnostic

48304ba5e6f9fe08f3fa1abda7d326ab.png

# WARNING The --port option is not used in the --diagnostic mode.

# WARNING: The--user option is only used forthe default mode.

# 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 forthe columns and the resulting statement may not be syntactically correct.

# Reading .frmfile for /root/t1.frm:

# The .frmfileis a TABLE.

# CREATE TABLE Statement:

CREATE TABLE `root`.`t1` (

`a`int(11) NOT NULL,

`b`int(11) DEFAULT NULL,

`c`int(11) DEFAULT NULL,

`d` varchar(600) DEFAULT NULL,

PRIMARY KEY `PRIMARY` (`a`),

KEY `idx_t1_bc` (`b`,`c`)

) ENGINE=InnoDB;

48304ba5e6f9fe08f3fa1abda7d326ab.png

【2.3】使用--server方式恢复

mysqlfrm --server=user:password@192.168.1.100:3306 /root/t1.frm --port=3434 --user=mysql --diagnostic

48304ba5e6f9fe08f3fa1abda7d326ab.png

WARNING: Using a password on the command line interface can be insecure.

# WARNING The--port option is not used in the --diagnostic mode.

# WARNING: The--user option is only used forthe default mode.

# Source on192.168.1.100: ... connected.

# 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 forthe columns and the resulting statement may not be syntactically correct.

# Reading .frmfile for /root/t1.frm:

# The .frmfileis a TABLE.

# CREATE TABLE Statement:

CREATE TABLE `root`.`t1` (

`a`int(11) NOT NULL,

`b`int(11) DEFAULT NULL,

`c`int(11) DEFAULT NULL,

`d` varchar(200) COLLATE `utf8_general_ci` DEFAULT NULL,

PRIMARY KEY `PRIMARY` (`a`),

KEY `idx_t1_bc` (`b`,`c`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

#...done.

48304ba5e6f9fe08f3fa1abda7d326ab.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值