An instance of a mysql data sheet damage caused by illegal shutdown
Check the process of repairing the data table:
1.When accessing the webpage, an error is displayed and the database cannot be connected.
2, start the mysql service, uninstall and close the mysql service
(you installed postfix yesterday as if yum installed mysql), use netstat-anp |grep mysqld Command to check that the mysql service is not up, and the server cannot be connected with mysql-uroot-p.
3.Check the error message:
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.
It is found that the database table is damaged.(./Mysql/host)
4.Repair the database table:
cd/var/lib/mysql/mysql
myisamchk-of host.MYI
-recovering (with keycache) MyISAM-table'host.MYI'
Data records: 0
The restoration of table host.MYI is successful.
5.Start the service again, check whether the service is started, log in to mysql, and it still doesn't work.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?) 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' in stead.
6.It was found that the./mysql/user table was damaged.
[[email protected] mysql]# myisamchk-of user.MYI
-recovering (with keycache) MyISAM-table'user.MYI'
Data records: 6
7.The table is repaired successfully, but the service still cannot be started, continue to look at 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?) 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.The last error is that the./mysql/db table has not been repaired and continue to repair the./mysql/db table.
9.Execute the following command to repair the./mysql/db table:
[[email protected] 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.Check if the service is running.
[[email protected] ~]# 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
At this time, it is found that the service is running.
12.Try to log in to mysql.
[[email protected] ~]# 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>
You can log in.
13.Open the webpage and it can be accessed normally, indicating that the data table of the MySQL database has been repaired successfully.
0 Comments