摘要
导入 MySQL FRM 文件涉及将预编译查询的元数据和结构从一个模式导入到另一个模式。它允许在不同的模式或数据库之间快速轻松地复制表定义,而无需重建表。通过使用 FRM 文件,可以保留索引、外键约束和触发器之类的对象,从而简化迁移并确保数据完整性。
详细说明
步骤 1:准备 FRM 文件
mysqldump --no-data --single-transaction --routines --triggers --lock-tables=false 源模式 > my_table.frm
步骤 2:导入 FRM 文件
mysql 目标模式 < my_table.frm
步骤 3:验证导入
information_schema.tables 表以验证目标模式中已创建表。information_schema.innodb_tablespaces 表以验证已创建表空间。information_schema.innodb_table_stats 表以验证已收集表统计信息。information_schema.innodb_indexes 表以验证已创建索引。information_schema.innodb_foreign_key_constraints 表以验证已创建外键约束。information_schema.innodb_triggers 表以验证已创建触发器。其他注意事项
INSERT 语句或数据转储手动导入数据。示例
以下示例演示如何将 my_table 表的 FRM 文件从 source_schema 模式导入到 target_schema 模式:
# 导出 FRM 文件
mysqldump --no-data --single-transaction --routines --triggers --lock-tables=false source_schema > my_table.frm
# 导入 FRM 文件
mysql target_schema < my_table.frm
# 验证导入
SELECT * FROM information_schema.tables WHERE table_schema = "target_schema" AND table_name = "my_table";
SELECT * FROM information_schema.innodb_tablespaces WHERE name = "my_table";
SELECT * FROM information_schema.innodb_table_stats WHERE table_schema = "target_schema" AND table_name = "my_table";
SELECT * FROM information_schema.innodb_indexes WHERE table_schema = "target_schema" AND table_name = "my_table";
SELECT * FROM information_schema.innodb_foreign_key_constraints WHERE table_schema = "target_schema" AND table_name = "my_table";
SELECT * FROM information_schema.innodb_triggers WHERE table_schema = "target_schema" AND table_name = "my_table";以上就是mysql如何导入frm的详细内容,更多请关注编程网其它相关文章!
--结束END--
本文标题: mysql如何导入frm
本文链接: https://www.lsjlt.com/wiki/b1eb9a3993.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0