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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义