MySql教程

【MySQL故障处理】[ERROR] Failed to open log (file '/data/mysql_3306/logs/mysql_bin.000012', errn

本文主要是介绍【MySQL故障处理】[ERROR] Failed to open log (file '/data/mysql_3306/logs/mysql_bin.000012', errn,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

【MySQL故障处理】[ERROR] Failed to open log (file '/data/mysql_3306/logs/mysql_bin.000012', errno 2)
修改MySQL实例端口号3306到3307
$ ll mysql_3306/
total 4
drwxrwxr-x 8 mysql mysql 185 Aug 30 10:09 data
drwxrwxr-x 2 mysql mysql 20 Aug 30 10:04 etc
drwxrwxr-x 2 mysql mysql 49 Aug 30 09:57 init.d
drwxrwxr-x 2 mysql mysql 4096 Aug 30 10:10 logs
drwxrwxr-x 9 mysql mysql 129 Jun 25 16:06 mysql
drwxrwxr-x 2 mysql mysql 23 Aug 30 10:09 run
drwxrwxr-x 2 mysql mysql 6 Jun 25 16:05 tmp

$ ps -ef |grep mysql
mysql 2577 2576 0 Jul05 pts/6 00:00:00 /bin/bash
root 17195 614 0 09:36 ? 00:00:00 sshd: mysql [priv]
mysql 17206 17195 0 09:36 ? 00:00:00 sshd: mysql@pts/0
mysql 17207 17206 0 09:36 pts/0 00:00:00 -bash
mysql 25915 1 0 10:09 pts/0 00:00:00 /bin/sh /data/mysql_3306/mysql/bin/mysqld_safe --defaults-file=/data/mysql_3306/etc/my.cnf --user=mysql
mysql 26549 25915 52 10:09 pts/0 00:00:02 /data/mysql_3306/mysql/bin/mysqld --defaults-file=/data/mysql_3306/etc/my.cnf --basedir=/data/mysql_3306/mysql --datadir=/data/mysql_3306/data --plugin-dir=/data/mysql_3306/mysql/lib/plugin --log-error=/data/mysql_3306/logs/mysql_error.log --open-files-limit=65535 --pid-file=/data/mysql_3306/run/mysql.pid --port=3307
关闭MySQL实例
$ sh init.d/stop_mysql.sh
修改数据库启动参数文件my.cnf
$ vi etc/my.cnf
将3306修改为3307
启动MySQL实例
$ sh init.d/start_mysql.sh

启动实例失败,启动过程中,错误日志信息:
2021-08-30T02:05:44.156637Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-08-30T02:05:44.156665Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-08-30T02:05:44.159627Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 184451891346
2021-08-30T02:05:44.159898Z 0 [Note] InnoDB: Loading buffer pool(s) from /data/mysql_3307/data/ib_buffer_pool
2021-08-30T02:05:44.160239Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: File '/data/mysql_3306/logs/mysql_bin.000012' not found (Errcode: 2 - No such file or directory)
2021-08-30T02:05:44.174375Z 0 [ERROR] Failed to open log (file '/data/mysql_3306/logs/mysql_bin.000012', errno 2)
2021-08-30T02:05:44.174386Z 0 [ERROR] Could not open log file
2021-08-30T02:05:44.174397Z 0 [ERROR] Can't init tc log
2021-08-30T02:05:44.174407Z 0 [ERROR] Aborting

处理方式:
$ cp mysql_bin.index mysql_bin.index.bk
$ vi mysql_bin.index
启动MySQL实例
$ sh init.d/start_mysql.sh

mysql> show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql_bin.000013 | 154 |
+------------------+-----------+
1 row in set (0.00 sec)

mysql> flush logs;
Query OK, 0 rows affected (0.01 sec)

mysql> show binary logs;\
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql_bin.000013 | 353 |
| mysql_bin.000014 | 154 |
+------------------+-----------+
2 rows in set (0.00 sec)

这篇关于【MySQL故障处理】[ERROR] Failed to open log (file '/data/mysql_3306/logs/mysql_bin.000012', errn的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!