dpgvdfg321041670
2013-07-25 14:07
浏览 89
已采纳

从.frm文件中检索MySQL表模式以创建SQL脚本

I recently received a MySQL database from my vendor (whose contract is now closed) and followed their instructions to set up PHP and MySQL on localhost, however using the phpMyAdmin interface I could only see a few of the tables that were visible in the DB directory.

I noticed that those tables that I was able to see (and query) in phpMyAdmin actually had all 3 files types (.frm .MYD .MYI) but the 'missing' ones had only one type (.frm).

How do I use the .frm file (which is schema) to create SQL scripts that will allow me to re-generate the tables in full?

图片转代码服务由CSDN问答提供 功能建议

我最近从我的供应商处收到了一个MySQL数据库(其合同现已关闭)并按照他们的指示设置PHP 和localhost上的MySQL,但是使用phpMyAdmin接口,我只能看到DB目录中可见的一些表。

我注意到我在phpMyAdmin中能够看到(和查询)的那些表实际上有所有3种文件类型(.frm .MYD .MYI)但是“缺失”的那些只有 一种类型(.frm)。

如何使用.frm文件(模式)创建允许我完全重新生成表的SQL脚本?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqr91899 2013-07-25 14:27
    已采纳

    You actually can´t restore data from your .frm files, however its no problem to get the table defintion out of this files. Do the following:

    1. Create a new table with the same name as the .frm file (so e.g. yada.frm will become yada table)
    2. stop your mysql daemon
    3. copy over the old old .frm file to the location where the new .frm is stored
    4. restart your mysql deamon
    5. you should now be able to get the table defintion by SHOW CREATE TABLE yada
    已采纳该答案
    打赏 评论

相关推荐 更多相似问题