Mysql数据迁移启动报错:/mysqld: File ‘./mysql-bin.000XXX’ not found

Mysql数据迁移启动报错:/mysqld: File ‘./mysql-bin.000XXX’ not found

背景:将mysql 的var目录下的mysql-bin.000XXX文件全部删除然后重启mysql是否磁盘占用,权限正常的情况下,无法启动mysql,报错:

Starting MySQL… ERROR! The server quit without updating PID file (/www/wdlinux/mysql-5.5.36/data/ebs-37.pid).

查看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.000156' 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.000156 这个日志文件
但是mysql-bin.index里面却有mysql-bin.000156的记录
办法是:
cp mysql-bin.index mysql-bin.index.bak
然后编辑mysql-bin.index 去掉 mysql-bin.000156这一行数据

但是并不奏效,最后将 mysql-bin.index 文件通过mv 重命名,然后重启mysql自动重建,服务启动正常直接搞定。

西数超哥学习乐园,西数超哥基础运维经验教程分享的学习乐园,西数超哥博客,运维经验教程交流学习分享的博客

原创文章,作者:zhang sir,如若转载,请注明出处:https://www.ysidc.top/8524.html

发表评论

邮箱地址不会被公开。 必填项已用*标注