While starting the server you may find the below errors sometimes, it's because of unintentionally deleting the MySQL Binary Log files. When starting mysql if the server unable to find the mysql-bin-log files then below errors will arise.
Well, we have two types of workarounds to start MySQL again.
1. Deleting the missed files in binlog .index file
2. Disabling the binlog logging on my.cnf file
1. Deleting the missed files in binlog .index file
2. Disabling the binlog logging on my.cnf file
In this step, open my.cnf and set the value of set_log_bin to 0 and purge all the existing binary logs
After this step, Enable the Binary log again to write the changes to binlog files.
To do that login to MySQL again and do below.
Note: The second procedure is not the recommended way to apply in Production.
170418 12:15:19 InnoDB: 5.5.30 started; log sequence number 32347593422 /usr/sbin/mysqld: File './mysql-bin.000023' not found (Errcode: 2) 170418 12:15:19 [ERROR] Failed to open log (file './mysql-bin.000023', errno 2) 170418 12:15:19 [ERROR] Could not open log file 170418 12:15:19 [ERROR] Can't init tc log 170418 12:15:19 [ERROR] Aborting 170418 12:15:19 InnoDB: Starting shutdown... 170418 12:15:20 InnoDB: Shutdown completed; log sequence number 32347593422 170418 12:15:20 [Note] /usr/sbin/mysqld: Shutdown completeDo we have a solution to get rid of this and start MySQL again?
Well, we have two types of workarounds to start MySQL again.
1. Deleting the missed files in binlog .index file
2. Disabling the binlog logging on my.cnf file
1. Deleting the missed files in binlog .index file
$ vi mysql-bin.indexDelete the mysql-bin.000023 from the above file and restart the mysqld.mysql-bin.000016 mysql-bin.000017 mysql-bin.000018 mysql-bin.000019 mysql-bin.000020 mysql-bin.000021 mysql-bin.000022 mysql-bin.000023
2. Disabling the binlog logging on my.cnf file
In this step, open my.cnf and set the value of set_log_bin to 0 and purge all the existing binary logs
$ vi my.cnf sql_log_bin = 0Save the above file and restart the mysql service. Once after login to the server purge the bin logs.
$ mysql -u root -p -A -v Enter Password: mysql> PURGE BINARY LOGS;This will delete the existing logs from the server.
After this step, Enable the Binary log again to write the changes to binlog files.
To do that login to MySQL again and do below.
$ mysql -u root -p -A -v Enter Password: mysql> SET sql_log_bin = 1;Once after finishing this, edit the my.cnf file and set the sql_log_bin from 0 to 1and restart the service.
Note: The second procedure is not the recommended way to apply in Production.
Comments
Post a Comment