MySql_Utilities安装与并查看frm格式文件

安装

tar -zxvf mysql-utilities-1.6.5.tar.gz
cd mysql-utilities-1.6.5
python ./setup.py build
python ./setup.py install

连接MySQL服务器

使用mysql_config_editor工具添加如下连接信息:

[root@localhost mysql-utilities-1.6.5]# mysql_config_editor set --login-path=instance_3306 --host=localhost --user=root --port=3306 --password
Enter password: 

查看链接信息

[root@localhost mysql]# mysql_config_editor print --login-path=instance_3306
[instance_3306]
user = root
password = *****
host = localhost
port = 3306

连接测试

[root@localhost mall]# mysqlserverinfo --server=instance_3306 --format=vertical
# Source on localhost: ... connected.
*************************       1. row *************************
                   server: localhost:3306
              config_file: /etc/my.cnf
               binary_log: 
           binary_log_pos: 
                relay_log: 
            relay_log_pos: 
                  version: 5.7.9
                  datadir: /usr/local/mysql/data/
                  basedir: /usr/local/mysql
               plugin_dir: /usr/local/mysql/lib/plugin/
              general_log: OFF
         general_log_file: 
    general_log_file_size: 
                log_error: /usr/local/mysql/data/localhost.localdomain.err
      log_error_file_size: 52825 bytes
           slow_query_log: OFF
      slow_query_log_file: 
 slow_query_log_file_size: 

使用mysqlfrm 查看frm格式文件

[root@localhost mall]# mysqlfrm --server=instance_3306 account.frm --diagnostic

执行结果如下

CREATE TABLE `account` (
  `id` int(11) NOT NULL, 
  `name` varchar(50) COLLATE `utf8_general_ci` DEFAULT NULL, 
  `balance` int(255) DEFAULT NULL, 
PRIMARY KEY `PRIMARY` (`id`),
KEY `idx_balance` (`balance`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

如果是看本地数据库的文件可不必使用连接即可查看

[root@localhost mall]# mysqlfrm --diagnostic account.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 account.frm:
# The .frm file is a TABLE.
# CREATE TABLE Statement:

CREATE TABLE `account` (
  `id` int(11) NOT NULL, 
  `name` varchar(150) DEFAULT NULL, 
  `balance` int(255) DEFAULT NULL, 
PRIMARY KEY `PRIMARY` (`id`),
KEY `idx_balance` (`balance`)
) ENGINE=InnoDB;

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值