Ravi Jaganathan
Ravi Jaganathan

Reputation: 141

MySQL BinLog deleted in Linux

What I did to cause the error:

  1. I deleted the bin log files manually in linux server because I ran out of space Issue: Unable to start MySql

Command: service mysql status

mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: inactive (dead) (Result: exit-code) since Thu 2021-01-28 12:46:17 UTC; 3 days ago
   Main PID: 17328 (code=exited, status=1/FAILURE)
     Status: "Server startup in progress"

Jan 28 12:46:17 ubuntu systemd[1]: Stopped MySQL Community Server.

/var/log/mysql/error.log

2021-02-01T02:05:15.392838Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-02-01T02:05:16.300996Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-02-01T02:05:16.632810Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2021-02-01T02:05:16.633795Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'
mysqld: File './binlog.004716' not found (OS errno 2 - No such file or directory)
2021-02-01T02:05:16.701858Z 0 [ERROR] [MY-010958] [Server] Could not open log file.
2021-02-01T02:05:16.702508Z 0 [ERROR] [MY-010041] [Server] Can't init tc log
2021-02-01T02:05:16.703740Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-02-01T02:05:18.105975Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22-0ubuntu0.20.04.2)  (Ubuntu)

/var/lib/mysql/binlog.index

lots of files in the following format
./binlog.003926
./binlog.003927

I am not able to find any help that will help dummies like me to fix the DB Startup error.

Any help is greatly appreciated

Upvotes: 2

Views: 1861

Answers (2)

hardik prajapati
hardik prajapati

Reputation: 1

Thanks Chris, the solution does work. I encountered similar situation and I renamed the .index file to backup file and tried to restart the services using below commands. It will generate a new index file with log file.

#Take backup of old bin.index file

cd /var/logs/mysql    
mv mysql-log.bin.index mysql-log.bin.index-backup

#Restart mysqld services

systemctl restart mysqld

#Check mysqld service status

systemctl status mysqld

It works!

Upvotes: 0

Chris Judd
Chris Judd

Reputation: 41

I found that opening the .index file and deleting all the entries (after making a copy just in case) the service kick-started and ran again

Upvotes: 4

Related Questions