Mysql資料表一直顯示使用中的修複方法

來源:互聯網
上載者:User


開啟phpmyadmin選擇資料庫查看,果然有3個表顯示為“使用中”。勾選之後進行“修複表”,出現錯誤提示不能被修複。

於是接著從“分析表”、“最佳化表”開始,均告失敗。失敗資訊第一條:can't create new temp file


1.表損壞的原因分析

以下原因是導致mysql 表毀壞的常見原因:
1、 伺服器突然斷電導致資料檔案損壞。
2、 強制關機,沒有先關閉mysql 服務。
3、 mysqld 進程在寫表時被殺掉。
4、 使用myisamchk 的同時,mysqld 也在動作表。
5、 磁碟故障。
6、 伺服器死機。
7、 mysql 本身的bug 。

2.表損壞的癥狀

一個損壞的表的典型癥狀如下:
1 、當在從表中選擇資料之時,你得到如下錯誤:
Incorrect key file for table: '...'. Try to repair it
2 、查詢不能在表中找到行或返回不完全的資料。
3 、Error: Table 'p' is marked as crashed and should be repaired 。
4 、開啟表失敗: Can't open file: ‘×××.MYI' (errno: 145) 。

google解決方案:強制修複 myisamchk -r -f ****.MYI,問題依舊

方法一:

重啟動mysql,簡單,一般會有效。

方法二:

運行SQL語句,登陸phpmyadmin,運行如下語句,多數可以決絕。

CHECK TABLE `table1`; ANALYZE TABLE `table1`; REPAIR TABLE `table1`;

方法三:
 
登陸phpmyadmin,首頁有個“狀態”標籤,點擊進去伺服器選項卡下有個殺死進程的。

方法四:

使用linux命令解決Mysql資料表一直顯示使用中。以lampp伺服器整合套件為例,資料庫顯示“使用中”,操作命令如下:

/opt/lampp/lampp stopmysql cd /opt/lampp/var/mysql/ /opt/lampp/bin/myisamchk -f miningplants/wp_options.MYI (資料庫名、資料表名) /opt/lampp/lampp startmysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.