成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

一個MySQL數據庫非法關機造成數據表損壞的實例

數據庫 MySQL
本文主要介紹了修復由于非法硬件關機造成MySQL數據庫數據表損壞的過程,希望能夠對您有所幫助。

本文我們介紹由于非法硬件關機,造成了MySQL數據庫數據表損壞,數據庫不能正常運行的一個實例,接下來是作者排查錯誤的過程,讓我們來一起了解一下吧。

排查修復數據表的經過如下:

 

1、訪問網頁,提示錯誤,連接不到數據庫。

2、啟動mysql服務,卸載和關閉rpm安裝的mysql服務(昨天安裝postfix好像yum安裝了mysql),用netstat -anp |grep mysqld 命令查看mysql服務沒有起來,用mysql -uroot -p也連接不到服務器。

3、查看錯誤提示:

 

  1. 110726 17:02:23 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.  
  2.  
  3. 110726 17:02:23 [ERROR] /usr/local/mysql/libexec/mysqld: Table './mysql/host' is marked as crashed and last (automatic?) repair failed  
  4.  
  5. 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  
  6.  
  7. 110726 17:02:23 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended  
  8.  
  9. 110726 17:24:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql  
  10.  
  11. 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)

4、修復數據庫表:

 

  1. cd /var/lib/mysql/mysql  
  2.  
  3. myisamchk -of host.MYI  
  4.  
  5. - recovering (with keycache) MyISAM-table 'host.MYI'  
  6.  
  7. Data records: 0  
  8.  
  9. 表host.MYI修復成功。 

 

5、再次啟動服務,查看服務是否啟動,登錄mysql,還是不行。所以再次查看錯誤日志。

 

  1. /usr/local/mysql/libexec/mysqld: Table './mysql/plugin' is marked as crashed and last (automatic?) repair failed  
  2.  
  3. /usr/local/mysql/libexec/mysqld: Table 'plugin' is marked as crashed and last (automatic?) repair failed  
  4.  
  5. 110726 17:24:31 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.  
  6.  
  7. 110726 17:24:31 [ERROR] /usr/local/mysql/libexec/mysqld: Table './mysql/user' is marked as crashed and last (automatic?) repair failed  
  8.  
  9. 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  
  10.  
  11. 110726 17:24:31 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended  
  12.  
  13. 110726 17:27:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql  
  14.  
  15. 110726 17:27:13 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead. 

 

6、又發現./mysql/user表損壞。

 

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

 

7、表修復成功,但是還是啟動不了服務,繼續看錯誤日志。

 

  1. /usr/local/mysql/libexec/mysqld: Table './mysql/plugin' is marked as crashed and last (automatic?) repair failed  
  2.  
  3. /usr/local/mysql/libexec/mysqld: Table 'plugin' is marked as crashed and last (automatic?) repair failed  
  4.  
  5. 110726 17:27:13 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.  
  6.  
  7. 110726 17:27:13 [ERROR] /usr/local/mysql/libexec/mysqld: Table './mysql/db' is marked as crashed and last (automatic?) repair failed  
  8.  
  9. 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  
  10.  
  11. 110726 17:27:13 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended 

 

8、最后一個錯誤,是./mysql/db表還沒有修復好繼續修復./mysql/db表。

9、執行下面的命令修復./mysql/db表:

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

 

10、最后啟動mysql服務。

 

  1. /usr/local/mysql/bin/mysqld_safe & 

 

11、查看服務是否在運行。

 

  1. [root@localhost ~]# netstat -anp | grep mysqld  
  2.  
  3. tcp        0      0   
  4.  
  5. 0.0.0.0:3306                  
  6.  
  7. 0.0.0.0:*                   LISTEN        
  8.  
  9. 4360/mysqld           
  10.  
  11. unix  2      [ ACC ]     STREAM     LISTENING     14172    
  12.  
  13. 4360/mysqld         /tmp/mysql.sock 

 

這時發現服務已運行。

12、登錄mysql試試。

 

  1. [root@localhost ~]# mysql -uroot -p123456  
  2.  
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  4.  
  5. Your MySQL connection id is 35  
  6.  
  7. Server version: 5.1.55-log Source distribution  
  8.  
  9. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.  
  10.  
  11. This software comes with ABSOLUTELY NO WARRANTY. This is free software,  
  12.  
  13. and you are welcome to modify and redistribute it under the GPL v2 license  
  14.  
  15. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  16.  
  17. mysql>  

 

能登錄。

13、在打開網頁,已經能正常訪問。證明MySQL數據庫的數據表就修復成功了。

關于MySQL數據庫數據表損壞的問題就介紹到這里了,如果您有興趣了解更多關于MySQL數據庫的知識,可以看一下這里的文章:http://database.51cto.com/mysql/,相信一定會帶給您收獲的!

【編輯推薦】

  1. 用mysqldumpslow分析執行較慢的SQL語句
  2. 關于MySQL事務的操作示例以及注意事項
  3. 使用MySQL Proxy告終讀寫離別的操作實例
  4. 開啟了log-bin的MySQL數據庫如何備份還原
  5. MySQL數據庫安裝過程中常見錯誤的解決方案
責任編輯:趙鵬 來源: 網易博客
相關推薦

2010-06-09 16:55:47

MySQL數據表

2011-07-20 17:02:51

Oracle數據庫

2010-05-12 18:35:25

MySQL數據表

2011-07-20 13:40:00

SQLite數據庫查詢數據

2017-05-25 10:23:13

數據a表b表

2010-06-13 17:35:17

MySQL數據表

2010-05-17 17:54:39

MySQL 數據庫

2011-07-20 12:55:17

SQLite數據庫插入數據

2010-05-20 14:25:25

2018-02-25 17:30:18

2011-07-20 13:18:01

SQLite數據庫修改和刪除數據

2011-08-18 18:18:05

MySQL數據庫優化

2011-07-20 14:57:47

SQLite數據庫ORDER BYGROUP BY

2011-07-21 16:28:20

MySQL數據庫帶游標的存儲過程

2011-08-22 16:41:35

MySQL1067進程意外終止

2022-12-28 08:17:36

數據庫數據導出

2011-08-02 12:46:46

Oracle數據表建立索引

2010-10-13 11:54:00

MySQL數據庫表

2009-06-22 13:50:00

java連接mysql

2021-03-04 14:10:04

Mysql數據庫數據表
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 日韩欧美视频网站 | 亚洲国产成人久久久 | 亚洲一区二区在线播放 | 免费成人高清 | 热99精品视频 | 中文字幕日韩欧美 | av网站免费看 | 久久99精品国产自在现线小黄鸭 | 亚洲国产一 | 国产中文字幕在线 | 久久不射电影网 | 欧美日韩亚洲一区 | 日日碰碰 | 伊人久久一区二区 | 久久精品亚洲国产奇米99 | 国产视频二区 | 日韩欧美成人精品 | 欧美一区二区三区久久精品 | 女同videos另类| 蜜桃视频成人 | 高清视频一区二区三区 | 黄色毛片视频 | 波多野结衣一区二区三区 | 久久噜噜噜精品国产亚洲综合 | 国产不卡一区 | 国产精品久久久久久亚洲调教 | 亚洲三区在线播放 | 人成在线视频 | 国产精品久久 | 久久久激情视频 | 日韩免费高清视频 | 成人精品一区二区户外勾搭野战 | 亚洲一区二区三区在线 | 欧美一区二区三区在线视频 | 亚洲成人自拍网 | 不卡视频一区 | 亚洲国产免费 | 美女中文字幕视频 | hsck成人网| 可以看黄的视频 | 国产目拍亚洲精品99久久精品 |