mysql提示failed to open log

由于数据库的不正常关机导致数据库无法启动
ps -ef|grep mysql 
里面没有mysql的任何进程信息

service mysqld start 报错

错误1: mysql目录下面的tmp目录不见了
错误2:
然后在alter日志里面发现以下错误信息:

121016 19:16:19 InnoDB: The InnoDB memory heap is disabled
121016 19:16:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121016 19:16:19 InnoDB: Compressed tables use zlib 1.2.3
121016 19:16:19 InnoDB: Using Linux native AIO
121016 19:16:19 InnoDB: Initializing buffer pool, size = 10.0G
121016 19:16:20 InnoDB: Completed initialization of buffer pool
121016 19:16:20 InnoDB: highest supported file format is Barracuda.
121016 19:16:20  InnoDB: Waiting for the background threads to start
121016 19:16:21 Percona XtraDB (http://www.percona.com) 1.1.7-20.1 started; log sequence number 825493261848
/data1/mysql/bin/mysqld: File '/data1/mysql/log/mysql-bin.001618' not found (Errcode: 2)
121016 19:16:21 [ERROR] Failed to open log (file '/data1/mysql/log/mysql-bin.001618', errno 2)
121016 19:16:21 [ERROR] Could not open log file
121016 19:16:21 [ERROR] Can't init tc log
121016 19:16:21 [ERROR] Aborting

121016 19:16:21  InnoDB: Starting shutdown...
121016 19:16:26  InnoDB: Shutdown completed; log sequence number 825493261848
121016 19:16:26 [Note] /data1/mysql/bin/mysqld: Shutdown complete

解决办法:
1. 建立tmp目录
    cd /data1/mysql/
    mkdir tmp
 chown -R mysql:mysql tmp
2.  进入/data1/mysql/log/ 
    发现 并不存在mysql-bin.001618 这个日志文件
 但是mysql-bin.index里面却有mysql-bin.001618的记录
 办法是:
 cp mysql-bin.index mysql-bin.index.bak
 然后编辑mysql-bin.index 去掉 mysql-bin.001618 这一行数据
 
然后就能够正常的重启数据库了。

    A+
发布日期:2014年03月04日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: