首先要彻底杀掉所有运行的mysql进程,并暂时停止web服务器,以免再次出发mysql的调用
/etc/init.d/httpd stop
killall -9 mysqld
killall -9 mysqld_safe
现在用ps awxuf命令确认没有mysql相关进程在运行了
到/var/lib/mysql目录下,找到ibdata1、ib_logfile0、ib_logfile1等几个文件,将其改名或者移动走
执行/etc/init.d/mysqld restart重新启动mysqld
这时候再查看log,就会发现innodb的引擎会重建出错的文件
070316 12:41:35 mysqld started
InnoDB: The first specified data file ./ibdata1 did not
exist:
InnoDB: a new database to be created!
070316 12:41:35 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
070316 12:41:35 InnoDB: Log file ./ib_logfile0 did not exist: new
to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
070316 12:41:35 InnoDB: Log file ./ib_logfile1 did not exist: new
to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
070316 12:41:36 InnoDB: Started; log sequence number 0 0
/usr/libexec/mysqld: ready for connections.
Version: '4.1.12' socket: '/var/lib/mysql/mysql.sock' port: 3306
Source distribution
现在可以通过top命令确认mysqld是否正常运行。
执行/etc/init.d/httpd start正常启动web服务,并观察mysql是否正常,一般故障可以解决
注意:如果想禁用innodb的功能,可以在/etc/my.cnf里边的[mysqld]部分中,加入如下一行:
skip-innodb
然后重启mysqld服务,即可禁用innodb 。
但是不推荐禁用,如果部分mysql程序调用了存储过程,那么就无法工作了。
三.Mssql数据库的innodb的表如果损坏,出现了“正在使用中”,这种情况可能恢复数据源文件都不能恢复到正常,这就需要使用从好的正常库里导出的.sql的脚本,来导入脚本来恢复数据了!