欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

一次非法關(guān)機(jī)導(dǎo)致mysql數(shù)據(jù)表損壞的實(shí)例解決

 更新時(shí)間:2013年01月28日 20:03:31   作者:  
本文介紹由于非法硬件關(guān)機(jī),造成了mysql的數(shù)據(jù)表損壞,數(shù)據(jù)庫不能正常運(yùn)行的一個(gè)實(shí)例,接下來是作者排查錯(cuò)誤的過程,希望對(duì)大家能有所幫助

排查修復(fù)數(shù)據(jù)表的經(jīng)過:

1、訪問網(wǎng)頁,提示錯(cuò)誤,連接不到數(shù)據(jù)庫。

2、啟動(dòng)mysql服務(wù),卸載和關(guān)閉rpm安裝的mysql服務(wù)

(昨天安裝postfix好像yum安裝了mysql),用netstat -anp |grep mysqld 命令查看mysql服務(wù)沒有起來,用mysql -uroot -p也連接不到服務(wù)器。

3、查看錯(cuò)誤提示:

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.
發(fā)現(xiàn)提示數(shù)據(jù)庫表損壞。(./mysql/host)

4、修復(fù)數(shù)據(jù)庫表

cd /var/lib/mysql/mysql 
myisamchk -of host.MYI 
- recovering (with keycache) MyISAM-table 'host.MYI' 
Data records: 0 
表host.MYI修復(fù)成功。

5、再次啟動(dòng)服務(wù),查看服務(wù)是否啟動(dòng),登錄mysql,還是不行。所以再次查看錯(cuò)誤日志。

/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.

6、又發(fā)現(xiàn)./mysql/user表損壞。

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

7、表修復(fù)成功,但是還是啟動(dòng)不了服務(wù),繼續(xù)看錯(cuò)誤日志。

/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 ended

8、最后一個(gè)錯(cuò)誤,是./mysql/db表還沒有修復(fù)好繼續(xù)修復(fù)./mysql/db表。

9、執(zhí)行下面的命令修復(fù)./mysql/db表:

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

10、最后啟動(dòng)mysql服務(wù)。

/usr/local/mysql/bin/mysqld_safe &

11、查看服務(wù)是否在運(yùn)行。

[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
這時(shí)發(fā)現(xiàn)服務(wù)已運(yùn)行。

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> 
可以登錄。

13、打開網(wǎng)頁,已經(jīng)可以正常訪問了,說明MySQL數(shù)據(jù)庫的數(shù)據(jù)表修復(fù)成功。

相關(guān)文章

  • CentOS7.6安裝MYSQL8.0的步驟詳解

    CentOS7.6安裝MYSQL8.0的步驟詳解

    這篇文章主要介紹了CentOS7.6安裝MYSQL8.0的步驟,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-11-11
  • Mysql深入探索之Explain執(zhí)行計(jì)劃詳析

    Mysql深入探索之Explain執(zhí)行計(jì)劃詳析

    這篇文章主要給大家介紹了關(guān)于Mysql深入探索之Explain執(zhí)行計(jì)劃的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • mysql prompt一個(gè)特別好用的命令

    mysql prompt一個(gè)特別好用的命令

    本篇文章是對(duì)mysql中的prompt進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
    2013-06-06
  • MySql登錄時(shí)閃退的快速解決辦法

    MySql登錄時(shí)閃退的快速解決辦法

    這篇文章主要介紹了MySql登錄時(shí)閃退的快速解決辦法的相關(guān)資料,需要的朋友可以參考下
    2016-08-08
  • 使用Perl DBI操作MySQL的一些建議

    使用Perl DBI操作MySQL的一些建議

    這篇文章主要介紹了使用Perl DBI操作MySQL的一些建議,針對(duì)Perl下連接MySQL的DBD::MySQL這個(gè)模塊,需要的朋友可以參考下
    2015-05-05
  • mysql數(shù)據(jù)庫刪除重復(fù)數(shù)據(jù)只保留一條方法實(shí)例

    mysql數(shù)據(jù)庫刪除重復(fù)數(shù)據(jù)只保留一條方法實(shí)例

    這篇文章主要給大家介紹了關(guān)于mysql數(shù)據(jù)庫刪除重復(fù)數(shù)據(jù),只保留一條的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • 在ubuntu中重置mysql服務(wù)器root密碼的方法

    在ubuntu中重置mysql服務(wù)器root密碼的方法

    在ubuntu下安裝了mysql 5 server,結(jié)果不知道什么原因,安裝時(shí)輸入的root帳號(hào)密碼在使用時(shí)無論如何都不能通過數(shù)據(jù)庫服務(wù)器的驗(yàn)證。無奈只有重置mysql的root帳號(hào)密碼。查了一下,用了以下方法成功的重置了root帳號(hào)密碼
    2012-10-10
  • MySQL內(nèi)部函數(shù)的超詳細(xì)介紹

    MySQL內(nèi)部函數(shù)的超詳細(xì)介紹

    眾所周知MySQL有很多內(nèi)置的函數(shù),下面這篇文章主要給大家介紹了關(guān)于MySQL內(nèi)部函數(shù)的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2022-08-08
  • MySQL中的唯一索引的簡(jiǎn)單學(xué)習(xí)教程

    MySQL中的唯一索引的簡(jiǎn)單學(xué)習(xí)教程

    這篇文章主要介紹了MySQL中的唯一索引的簡(jiǎn)單學(xué)習(xí)教程,是MySQL入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下
    2015-11-11
  • Linux CentOS MySQL數(shù)據(jù)庫安裝配置教程

    Linux CentOS MySQL數(shù)據(jù)庫安裝配置教程

    這篇文章主要為大家詳細(xì)介紹了Linux CentOS MySQL數(shù)據(jù)庫的安裝配置教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-05-05

最新評(píng)論