[ERROR] mysqld: File ‘./mysql-bin.010228‘ not found (Errcode: 2 “No such file or directory“)

created at 05-29-2022 views: 3


To clear space, delete all bin logs

Start mysql and report an error, check the log /var/lib/mysql/mariadb.err

error reported:

2022-05-23 19:00:53 0 [ERROR] mysqld: File './mysql-bin.010228' not found (Errcode: 2 "No such file or directory")
2022-05-23 19:00:53 0 [ERROR] Failed to open log (file './mysql-bin.010228', errno 2)
2022-05-23 19:00:53 0 [ERROR] Could not open log file


With the use of MySQL database, many mysql-bin.XXXXXX files will be generated in the /var/lib/mysql/ directory, which will take up a lot of disk space.

These files are used to record the operation behavior of the MySQL database for data recovery and master-slave data synchronization.

These files can be deleted if the machine's disk space is insufficient and MySQL historical data recovery is not a concern.

How to handle

  1. Stop the MySQL service (service mysqld stop)
  2. Delete the files starting with mysql-bin (except mysql-bin.index)
  3. Modify the mysql-bin.index file and delete the deleted file name from the file
  4. Start the MySQL service (service mysqld start)

some people may choose to delete the index file:

Delete the index file (move it to the /tmp directory)

created at:05-29-2022
edited at: 05-29-2022: