首页 > 解决方案 > 在 Linux 中删除 MySQL BinLog

问题描述

我做了什么导致错误

  1. 我在 linux 服务器中手动删除了 bin 日志文件,因为空间不足 问题:无法启动 MySql

命令服务mysql状态

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

我找不到任何可以帮助像我这样的傻瓜修复数据库启动错误的帮助。

任何帮助是极大的赞赏

标签: mysqlmysqlbinlog

解决方案


我发现打开 .index 文件并删除所有条目(在复制后以防万一)服务启动并再次运行


推荐阅读