To troubleshoot the Repair data table:
1, access to the Web page, prompted errors, not connected to the database.
2, start the MySQL service, uninstall and close the RPM installed MySQL service
(Yesterday installed postfix like Yum installed MySQL), with the NETSTAT-ANP |grep mysqld command to view the MySQL service did not get up, with the mysql-uroot-p also not connected to the server.
3, view error tip:
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 a nd lock Privilege tables:table './mysql/host ' is marked as crashed and last (automatic?) repair failed 110726 I Sqld_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 Deprecat Ed and'll are removed in a future release. Please use '--skip-external-locking ' instead. The
Discovery prompts database table for corruption. (./mysql/host)
4. Repair Database table :
Cd/var/lib/mysql/mysql
Myisamchk-of host. Myi
-Recovering (with Keycache) myisam-table ' host. Myi '
Data records:0
Table host. Myi Repair succeeded.
5, start the service again, to see if the service is started, login MySQL, or not. So check the error log again.
/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?) r Epair failed
110726 17:24:31 [ERROR] Fatal Error:can ' t open and lock Privilege tables:table './mysql/user ' is marked as crashed and L AST (automatic?) repair failed 110726 17:24:31 mysqld_safe mysqld from PID file/var/lib/mysql/localhost.localdomain.pid E nded
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'll be removed in a future release. Please use '--skip-external-locking ' instead.
6, and found that./mysql/user table is damaged.
[Root@localhost mysql]# myisamchk-of user. Myi
-Recovering (with Keycache) myisam-table ' user. Myi '
Data Records:6
7, the table repair success, but still can not start the service, continue to read the error log.
/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?) rep Air failed
110726 17:27:13 [ERROR] Fatal Error:can ' t open and lock Privilege tables:table './mysql/db ' is marked as crashed and Las T (automatic?) repair failed
110726 17:27:13 mysqld_safe mysqld from PID File/var/lib/mysql/localhost.localdomain.pid ended
8, the last error, is./mysql/db table has not been repaired to continue the repair./mysql/db table.
9, perform the following command repair./mysql/db table:
[Root@localhost mysql]# myisamchk-of db. Myi
-Recovering (with Keycache) myisam-table ' db. Myi '
Data records:0
Data Records:2
10, finally start the MySQL service.
/usr/local/mysql/bin/mysqld_safe &
11, to see if the service is running.
[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
The discovery service is now running.
12, login MySQL try.
[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), the 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
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
Can log in.
13, open the Web page, has been normal access, indicating the MySQL database data table repair success.