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
service mysqld stop
)mysql-bin
(except mysql-bin.index
)mysql-bin.index
file and delete the deleted file name from the fileservice mysqld start
)some people may choose to delete the index file:
Delete the index file (move it to the /tmp
directory)