在mysql中导出binlog日志文件时报错,即用binlog日志恢复误删数据
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqlbinlog C:\ProgramData\MySQL\MySQL Server 8.0\Data\LAPTOP-T4VF13CU-bin.000028 --start-position=485 --stop-position=1125 -r 1.sql
ERROR: Binlog has bad magic number; It's not a binary log file that can be used by this version of MySQL
运行不报错,且运行后sql脚本文件里有可以直接在mysql数据库里执行的语句,执行后数据恢复
https://blog.csdn.net/li_xiao_ming/article/details/49100147 这个应该是正确的处理方法。
出现错误的原因是你最后一次失败的时候生成的binlog异常,所以解决方式是讲你发生数据库错误的时候的最后一个binlog删除掉
根据MySQL关闭的时间查看最新的数据文件是哪个,然后将它删除即可
删除掉最后一个binlog后,重新启动数据库