mysql error code 145_Mysql ERROR 145 (HY000) Table crashed

Errors about the table:

99b5b2f8e56b15d1a76920c55edf6c06.png

The cause behind the error

Low disk space could be a reason for MySQL table being marked as “crashed”. When you have low space on your disk, some of the tables in the database may get crashed. It usually happens when you get space issues on the part of the hard disk where your database is stored.

Often it gets difficult to identify the specific tables that are affected by the error. Before starting the repair process, thus, let us quickly take a look at how to identify the corrupted MySQL tables.

Identifying crashed MySQL tables

You can identify corrupted tables through certain expected and observable errors in the queries, for example:

Can’t find file tbl_name.MYI (Errcode: nnn)

Unexpected end of file

Got error from table handler

Record file is crashed

Can’t find file tablethatshouldbethere.MYI

tablethatwasworking.frm is locked against change

Got error ### from table handler.

You can run

Recovering MySQL Crashed Tables

MySQL server provides its own tool to diagnose crashed tables. This tool is known as myisamchk, and you can use it as shown below:

# myisamchk -s /var/lib/mysql/*/*.MYI

Running this command will list the crashed MySQL tables, with a message as follows:

MyISAM-table'/var/lib/mysql/dbname/table_name.MYI'ismarked ascrashed andshould be repaired.

Other than diagnosis, the tool can also help you repair the damaged table. In most cases, the problem is solved by running the myisamchk command.

#myisamchk -r /var/lib/mysql/dbname/table_name.MYI

But if it doesn’t solve the problem, try stopping your web service, so that no new requests are generated, stop the MySQLd daemon itself and run the below-given command:

#myisamchk -r --update-state /var/lib/mysql/dbname/table_name.MYI

The “–update-state” switch tells MySQL to mark the indicated table as “checked.” Once this has been done, restart your MySQLd and web service, and MySQL will repair the crashed table. As a result, the error will be removed, and your database will be safely restored.

Also, you can fixed this error by recovering database by using backup.

Also, You can repair this table directly.

f5d5cde1f3e8f11428b0504bb399cc79.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值