本地计算机上的MySQL服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止
1.查看mysql的错误日志
2.根据日志文件查找到错误
2023-04-21T17:19:43.104019Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-04-21T17:19:43.104045Z 0 [System] [MY-010116] [Server] D:\Computer\Mysql\mysql-8.0.31-winx64\mysql-8.0.31-winx64\bin\mysqld (mysqld 8.0.31) starting as process 8456
2023-04-21T17:19:43.182581Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-04-21T17:19:43.464004Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-04-21T17:19:43.599841Z 0 [ERROR] [MY-010958] [Server] Binlog has bad magic number; It's not a binary log file that can be used by this version of MySQL.
2023-04-21T17:19:43.600300Z 0 [ERROR] [MY-010041] [Server] Can't init tc log
2023-04-21T17:19:43.600469Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-04-21T17:19:44.785691Z 0 [System] [MY-010910] [Server] D:\Computer\Mysql\mysql-8.0.31-winx64\mysql-8.0.31-winx64\bin\mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
3.解决方法
找到
binlog
日志文件,里面存放了所有的binlog的日志文件引用,然后找到最新的binlog
文件引用,然后再找到这个日志存放的位置,再将这个文件进行删除。
4.总结
以上操作对应的是我mysql8.0的数据库,总解决思路就是:根据MySQL关闭的时间查看最新的数据文件是哪个,然后将它删除即可