成人免费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數據表

2017-05-25 10:23:13

數據a表b表

2010-06-13 17:35:17

MySQL數據表

2011-07-20 13:40:00

SQLite數據庫查詢數據

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-07-20 14:57:47

SQLite數據庫ORDER BYGROUP BY

2011-08-18 18:18:05

MySQL數據庫優化

2022-12-28 08:17:36

數據庫數據導出

2011-07-21 16:28:20

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

2011-08-22 16:41:35

MySQL1067進程意外終止

2011-08-02 12:46:46

Oracle數據表建立索引

2009-06-22 13:50:00

java連接mysql

2021-03-04 14:10:04

Mysql數據庫數據表

2010-10-13 11:54:00

MySQL數據庫表
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 久久久爽爽爽美女图片 | 国产一区二区av | 一区二区在线看 | 亚洲 欧美 综合 | 国产精品激情 | 国产在线观看一区二区三区 | 成人国产精品免费观看 | 国产日韩一区 | 日韩精品在线观看一区二区三区 | www.日本国产 | 精品九九 | 国产一区二区三区免费观看视频 | 在线播放一区 | 在线视频一区二区三区 | 国产97碰免费视频 | 99亚洲综合| 久草在线| 欧美一区永久视频免费观看 | 7777精品伊人久久精品影视 | 日韩国产精品一区二区三区 | 亚洲精品久久 | 亚洲免费观看视频网站 | 亚洲视频免费观看 | 蜜臀久久| www.788.com色淫免费| 精品中文字幕视频 | 热久久免费视频 | 亚洲国产精品精华素 | 高清视频一区二区三区 | 国产精品日日做人人爱 | www.四虎.com | 欧美色综合网 | 久久久久久久久91 | 久久这里只有精品首页 | 精品久久久久久一区二区 | 妞干网视频 | 网站一区二区三区 | a亚洲精品| 日本中文字幕视频 | 国产精品日韩欧美一区二区 | 午夜影院免费体验区 |