MYSQL錯誤#145的解決辦法總結

來源:互聯網
上載者:User

Mysql有的時候因為掉電或者其他原因導致資料庫損壞,錯資訊如下:

MySql: Can't open file: 'sdb_sessions.MYI'. (errno: 145)

For more information, see Help and Support Center at

我們可以使用mysql內建的mysqlcheck命令來快速修複所有的資料庫或者特定的資料


如果你的資料庫主機就你一個人用,並且你還能控制的話,建議你用Mysql內建的修複工具myisamchk.exe進行修複,操作如下:

修複前將mysql服務停止。
如果是Win主機,開啟命令列方式,然後進入到mysql的/bin目錄。
執行myisamchk -r  資料庫所在路徑*.MYI
如果是類Unix主機,直接使用myisamchk -r  資料庫目錄*.MYI


使用命令myisamchk修複資料庫的MYI檔案即可

 代碼如下 複製代碼

# /usr/local/mysql5/bin/myisamchk -c -r /bak/lib/mysql/yourealcn/biz_user.*

myisamchk: error: ‘/bak/lib/mysql/yourealcn/biz_user.frm’ is not a
MyISAM-table

———

myisamchk: error: ‘/bak/lib/mysql/yourealcn/biz_user.MYD’ is not a
MyISAM-table

———

- recovering (with sort) MyISAM-table ‘/bak/lib/mysql/yourealcn/biz_user.MYI’

Data records: 20414
- Fixing index 1
- Fixing index 2
- Fixing
index 3
- Fixing index 4


其實還有一個簡單的方法開啟你的myphpadmin,選中Can’t open file:後面同名的表,有個下拉式功能表“選中項”,選擇“修複”

1. 進入管理mysql的phpmyadmin
2. 在左則選中自己的資料庫
3. 在右則勾選中錯誤資訊中的那個’xxx’表
4.
滾動螢幕到下面,有個下拉式功能表(With selected:),選擇”Repair table”

修改之後,並沒有發現有什麼資料損失,連忙備份了一份資料庫到郵件裡面,備份還是很重要的

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.