【原创】Mysql ERROR 14…

ERROR 145 (HY000): Table './group4/group323' is marked as crashed and should be repaired

...
    line = cur.execute(sql)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 161, in execute
    r = self._query(query)
KeyboardInterrupt

...
    line = cur.execute(sql)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.InternalError: (145, "Table './group4/group339' is marked as crashed and should be repaired")
今天在python-mysqldb中查询遇到的问题,数据是从windows上MS SQL 转为Mysql(MyISAM)的,数据直接挂载到目录下就能用。
但是查询的时候没有反映,也不报错,没有任何提示,想了想延时的问题,但是延时只能在链接的时间添加参数 onnect_timeout,execute不支持查询查询超市,除非在数据库中直接设置超时配置。

然后把这句话拷贝的数据库中试了试,
mysql> use group4;select um from group323 where Num = 32217473;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

^CCtrl-C -- exit!
Aborted

加上-A(不预读数据库)
mysql -uroot -p -A
mysql> use group4;select um from group323 where Num = 32217473;
Database changed

^CCtrl-C -- sending "KILL QUERY 786" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted

mysql> select QQNum as qq from group323 where QunNum = 32217473;

^CCtrl-C -- sending "KILL QUERY 786" to server ...
Ctrl-C -- query aborted.
ERROR 145 (HY000): Table './group4/group323' is marked as crashed and should be repaired
mysql> select um from group323 where Num = 32217473;

^CCtrl-C -- sending "KILL QUERY 786" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted

查了查145的原因,是因为索引文件损坏了,需要修复。
root@ubuntu:~#: myisamchk -c -r /var/lib/mysql/group4/group323.MYI
- recovering (with keycache) MyISAM-table '/var/lib/mysql/group4/group323.MYI'
Data records: 1395199
mysql> select um from group323 where Num = 32217473;
+-----------+
um        |
+-----------+
| 543057109 |
| 772193283 |
| 331913702 |
| 903525121 |
| 632300180 |
| 772687572 |
|   83959572 |
| 875214751 |
| 125599972 |
| 514400286 |
| 471481228 |
| 312371026 |
| 574164513 |
| 582299288 |
+-----------+
14 rows in set (0.00 sec)

搞定了,虽然没有加-A参数,也提示Reading table information for completion of table and column names,You can turn off this feature to get a quicker startup with -A。但是很快就提示了Database changed。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值