mysql 利用frm文件得到表的建表语句

1.下载

wget https://cdn.mysql.com/archives/mysql-utilities/mysql-utilities-1.6.5.tar.gz

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

cd mysql-utilities-1.6.5

python ./setup.py build

python ./setup.py install

 

2、mysqlfrm相关参数介绍

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

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

--diagnostic : 开启按字节模式来恢复frm结构

--user :启动MySQL用户,通过为mysql

 

3、mysqlfrm使用

 

[root@signsystem ~]# mysqlfrm --basedir=/usr/local/mysql /data/mysql/data/mysql3306/var/signingsystem/ --port=3306 --user=mysql --diagnostic
db.opt signpeople.frm signpeople.ibd
[root@signsystem ~]# mysqlfrm --basedir=/usr/local/mysql /data/mysql/data/mysql3306/var/signingsystem/signpeople.frm --port=3306 --user=mysql --diagnostic
# WARNING The --port option is not used in the --diagnostic mode.
# WARNING: The --user option is only used for the 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 for the columns and the resulting statement may not be syntactically correct.
# Reading .frm file for /data/mysql/data/mysql3306/var/signingsystem/signpeople.frm:
# The .frm file is a TABLE.
# CREATE TABLE Statement:

CREATE TABLE `signingsystem`.`signpeople` (
`no` int(11) NOT NULL AUTO_INCREMENT comment '序號',
`carno` varchar(180) DEFAULT NULL comment '车牌',
`company` varchar(900) DEFAULT NULL comment '公司',
`issign` int(1) DEFAULT NULL comment '是否签到',
`qrcode` varchar(900) DEFAULT NULL comment '二維碼',
`time` datetime DEFAULT NULL comment '签到时间',
PRIMARY KEY `PRIMARY` (`no`)
) ENGINE=InnoDB;

 

 

 

#...done.

 

 https://www.cnblogs.com/kcxg/p/11111042.html 

 

上一篇:创建表以及属性的一些格式


下一篇:3.MySQL数据管理