mysql匯入資料庫_只用frm向mysql匯入表結構

來源:互聯網
上載者:User

網上一個串連mysql的jsp程式碼片段,給了資料庫的備份檔案,但是只有frm,

mysql的每張表有三個檔案,分別是,*.frm是描述了表的結構,*.MYD儲存了表的資料記錄,*.MYI則是表的索引,

查了下資料,原來只有frm檔案也能匯入。

 

過程如下:

1.在mysql目錄下的data目錄中,找到要匯入表所在的資料庫的名稱,把frm檔案放進去,比如我這裡是offer.frm,資料庫名稱是netshop,

放到資料庫netshop目錄下之後,在mysql中show tables顯示如下

在這裡table是顯示的,但是desc offer就會提示下面錯誤

 

2,在與offer.frm同一目錄建立以下2個檔案,檔案內容可以為空白:
offer.MYD和offer.MYI

3. 在MYSQL命令列使用MYSQL本身的資料表恢複命令repair命令恢複表,如下:

根據結果可以知道,恢複命令執行成功,下邊用desc命令測試下:

 

作者:jason0539

微博:http://weibo.com/2553717707

部落格:http://blog.csdn.net/jason0539(轉載請說明出處)

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.