Mysql学习一次非法关机导致mysql数据表损坏的实例解决

Mysql学习一次非法关机导致mysql数据表损坏的实例解决,第1张

概述介绍《Mysql学习一次非法关机导致mysql数据表损坏的实例解决》开发教程,希望对您有用。

《MysqL学习一次非法关机导致MysqL数据表损坏的实例解决》要点:@H_502_3@本文介绍了MysqL学习一次非法关机导致MysqL数据表损坏的实例解决,希望对您有用。如果有疑问,可以联系我们。

排查修复数据表的经过:MysqL学习

1、拜访网页,提示错误,连接不到数据库.MysqL学习

2、启动MysqL服务,卸载和关闭rpm安装的MysqL服务

(昨天安装postfix好像yum安装了MysqL),用netstat -anp |grep MysqLd 命令查看MysqL服务没有起来,用MysqL -uroot -p也连接不到服务器.MysqL学习

3、查看错误提示:

110726 17:02:23 [ERROR] Can't open the MysqL.plugin table. Please run MysqL_upgrade to create it. 
110726 17:02:23 [ERROR] /usr/local/MysqL/libexec/MysqLd: table './MysqL/host' is marked as crashed and last (automatic?) repair Failed 
110726 17:02:23 [ERROR] Fatal error: Can't open and lock privilege tables: table './MysqL/host' is marked as crashed and last (automatic?) repair Failed 110726 17:02:23 MysqLd_safe MysqLd from pID file /var/lib/MysqL/localhost.localdomain.pID ended 
110726 17:24:31 MysqLd_safe Starting MysqLd daemon with databases from /var/lib/MysqL 
110726 17:24:31 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
发现提示数据库表损坏.(./MysqL/host)MysqL学习

4、修复数据库表:

cd /var/lib/MysqL/MysqL 
myisamchk -of host.MYI 
- recovering (with keycache) MyISAM-table 'host.MYI' 
Data records: 0 
表host.MYI修复成功.MysqL学习

5、再次启动服务,查看服务是否启动,登录MysqL,还是不行.所以再次查看错误日志.

/usr/local/MysqL/libexec/MysqLd: table './MysqL/plugin' is marked as crashed and last (automatic?) repair Failed 
/usr/local/MysqL/libexec/MysqLd: table 'plugin' is marked as crashed and last (automatic?) repair Failed 
110726 17:24:31 [ERROR] Can't open the MysqL.plugin table. Please run MysqL_upgrade to create it. 
110726 17:24:31 [ERROR] /usr/local/MysqL/libexec/MysqLd: table './MysqL/user' is marked as crashed and last (automatic?) repair Failed 
110726 17:24:31 [ERROR] Fatal error: Can't open and lock privilege tables: table './MysqL/user' is marked as crashed and last (automatic?) repair Failed 110726 17:24:31 MysqLd_safe MysqLd from pID file /var/lib/MysqL/localhost.localdomain.pID ended 
110726 17:27:13 MysqLd_safe Starting MysqLd daemon with databases from /var/lib/MysqL 
110726 17:27:13 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.MysqL学习

6、又发现./MysqL/user表损坏.

[root@localhost MysqL]# myisamchk -of user.MYI 
- recovering (with keycache) MyISAM-table 'user.MYI' 
Data records: 6MysqL学习

7、表修复成功,但是还是启动不了服务,继续看错误日志.

/usr/local/MysqL/libexec/MysqLd: table './MysqL/plugin' is marked as crashed and last (automatic?) repair Failed 
/usr/local/MysqL/libexec/MysqLd: table 'plugin' is marked as crashed and last (automatic?) repair Failed 
110726 17:27:13 [ERROR] Can't open the MysqL.plugin table. Please run MysqL_upgrade to create it. 
110726 17:27:13 [ERROR] /usr/local/MysqL/libexec/MysqLd: table './MysqL/db' is marked as crashed and last (automatic?) repair Failed 
110726 17:27:13 [ERROR] Fatal error: Can't open and lock privilege tables: table './MysqL/db' is marked as crashed and last (automatic?) repair Failed 
110726 17:27:13 MysqLd_safe MysqLd from pID file /var/lib/MysqL/localhost.localdomain.pID endedMysqL学习

8、最后一个错误,是./MysqL/db表还没有修复好继续修复./MysqL/db表.MysqL学习

9、执行下面的命令修复./MysqL/db表:

[root@localhost MysqL]# myisamchk -of db.MYI 
- recovering (with keycache) MyISAM-table 'db.MYI' 
Data records: 0 
Data records: 2MysqL学习

10、最后启动MysqL服务.

/usr/local/MysqL/bin/MysqLd_safe &MysqL学习

11、查看服务是否在运行.

[root@localhost ~]# netstat -anp | grep MysqLd 
tcp0  0  
0.0.0.0:3306 
0.0.0.0:*   ListEN
4360/MysqLd  
unix  2  [ ACC ] STREAM ListENING 14172
4360/MysqLd /tmp/MysqL.sock
这时发现服务已运行.MysqL学习

12、登录MysqL试试.

[root@localhost ~]# MysqL -uroot -p123456 
Welcome to the MysqL monitor.  Commands end with ; or \g. 
Your MysqL connection ID is 35 
Server version: 5.1.55-log Source distribution 
copyright (c) 2000,2010,Oracle and/or its affiliates. All rights reserved. 
This software comes with absoluteLY NO WARRANTY. This is free software, 
and you are welcome to modify and redistribute it under the GPL v2 license 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
MysqL> 
可以登录.MysqL学习

13、打开网页,已经可以正常拜访了,说明MysqL数据库的数据表修复成功.MysqL学习

内存溢出PHP培训学院每天发布《MysqL学习一次非法关机导致MysqL数据表损坏的实例解决》等实战技能,PHP、MysqL、liNUX、APP、Js,CSS全面培养人才。

总结

以上是内存溢出为你收集整理的Mysql学习一次非法关机导致mysql数据表损坏的实例解决全部内容,希望文章能够帮你解决Mysql学习一次非法关机导致mysql数据表损坏的实例解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/sjk/1153658.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存