排查修復資料表的經過:
1、訪問網頁,提示錯誤,連線不到資料庫。
2、啟動mysql服務,解除安裝和關閉rpm安裝的mysql服務
(昨天安裝postfix好像yum安裝了mysql),用netstat -anp |grep mysqld 命令檢視mysql服務沒有起來,用mysql -uroot -p也連線不到伺服器。
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)
4、修復資料庫表:
cd /var/lib/mysql/mysql
myisamchk -of host.myi
- recovering (with keycache) myisam-table 'host.myi'
data records: 0
表host.myi修復成功。
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.
6、又發現./mysql/user表損壞。
[root@localhost mysql]# myisamchk -of user.myi
- recovering (with keycache) myisam-table 'user.myi'
data records: 6
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 ended
8、最後乙個錯誤,是./mysql/db表還沒有修復好繼續修復./mysql/db表。
9、執行下面的命令修復./mysql/db表:
[root@localhost mysql]# myisamchk -of db.myi
- recovering (with keycache) myisam-table 'db.myi'
data records: 0
data records: 2
10、最後啟動mysql服務。
/usr/local/mysql/bin/mysqld_safe &
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
這時發現服務已執行。
12、登入mysql試試。13、開啟網頁,已經可以正常訪問了,說明mysql資料庫的資料表修復成功。
吳思進 區塊鏈可以解決非法集資的造假行為
什麼是區塊鏈?專注於區塊鏈技術應用開發的複雜美ceo吳思進做了乙個有趣的比喻,平常我們打撲克的時候,總會有乙個人去做記錄輸贏結果,但如果這個人記錄錯誤或者有心造假的話,就不一定能被發現,而加入區塊鏈 指共識伺服器 之後,就如同會有很多人都在做記錄,並且每一局後大家會相互校對結果,之後新加入的人會在大...
迷宮問題的DFS解決(非最短)
include include includeusing namespace std int a 7 7 struct point bool operator const point rhs 判斷當前的位置是否可以通過 int pass point node 當前位置移動到下一塊 point nex...
UBUNTU 解決非正常關閉APT GET的鎖
轉 在ubuntu的命令列視窗中使用apt get命令安裝程式,命令未執行完的情況下關閉視窗或使用ctrl c來結束命令。當我們再次使用apt get命令安裝程式的時候,報錯資訊如下 e 無法獲得鎖 var lib dpkg lock open 11 資源暫時不可用 e 無法鎖定管理目錄 var l...