此贴为备忘帖:

背景:将mysql 的var目录数据全部迁移至另一mysql服务器,权限正常的情况下 无法启动mysql,报错:

 ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

查看var下的localhost.localdomain.err日志,报错为:

170322 14:47:52 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170322 14:47:52 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 16800 ...
170322 14:47:52 [Note] Plugin 'FEDERATED' is disabled.
170322 14:47:52 InnoDB: The InnoDB memory heap is disabled
170322 14:47:52 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170322 14:47:52 InnoDB: Compressed tables use zlib 1.2.7
170322 14:47:52 InnoDB: Initializing buffer pool, size = 1.0G
170322 14:47:52 InnoDB: Completed initialization of buffer pool
170322 14:47:52 InnoDB: highest supported file format is Barracuda.
170322 14:47:53 InnoDB: Waiting for the background threads to start
170322 14:47:54 InnoDB: 5.5.48 started; log sequence number 75354824716
^G/usr/local/mysql/bin/mysqld: File './mysql-bin.000007' not found (Errcode: 2)
170322 14:47:54 [ERROR] Failed to open log (file './mysql-bin.000007', errno 2)
170322 14:47:54 [ERROR] Could not open log file
170322 14:47:54 [ERROR] Can't init tc log
170322 14:47:54 [ERROR] Aborting

尝试了网上的方法:

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 这一行数据

但是并不奏效,索性直接删除mysql-bin.index 文件,让mysql自动重建,直接搞定。