1. 查看mysql在启动的时候报了什么错
cat /var/log/mysqld.log
2.我这里报了这种错误“Unsupported redo log format (0). The redo log was created before MySQL 5.7.9”
2021-05-26T04:00:31.131541Z 1 [ERROR] [MY-013090] [InnoDB] Unsupported redo log format (0). The redo log was created before MySQL 5.7.9
2021-05-26T04:00:31.131683Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2021-05-26T04:00:31.573235Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2021-05-26T04:00:31.573525Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-05-26T04:00:31.573714Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-05-26T04:00:31.574691Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.
2021-05-26T04:00:51.086999Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 3815
2021-05-26T04:00:51.095545Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
2021-05-26T04:00:51.095632Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-26T04:00:51.288265Z 1 [ERROR] [MY-013090] [InnoDB] Unsupported redo log format (0). The redo log was created before MySQL 5.7.9
2021-05-26T04:00:51.288365Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2021-05-26T04:00:51.730217Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2021-05-26T04:00:51.730503Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-05-26T04:00:51.730677Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-05-26T04:00:51.731654Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.
2021-05-26T05:51:18.497111Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 5912
2021-05-26T05:51:18.505743Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
2021-05-26T05:51:18.505826Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-26T05:51:18.699025Z 1 [ERROR] [MY-013090] [InnoDB] Unsupported redo log format (0). The redo log was created before MySQL 5.7.9
2021-05-26T05:51:18.699125Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2021-05-26T05:51:19.140285Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2021-05-26T05:51:19.140577Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-05-26T05:51:19.140751Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-05-26T05:51:19.141732Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.
2021-05-26T06:06:08.352017Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 7192
2021-05-26T06:06:08.362750Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
2021-05-26T06:06:08.362836Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-05-26T06:06:09.243616Z 1 [ERROR] [MY-013168] [InnoDB] Cannot upgrade server earlier than 5.7 to 8.0
2021-05-26T06:06:14.245297Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2021-05-26T06:06:14.245735Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-05-26T06:06:14.247140Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-05-26T06:06:14.248157Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.
3. 输入以下命令删除该文件夹的所有内容
rm -rf /var/lib/mysql
4.启动MySQL
systemctl start mysqld
5.查看MySQL当前的状态,如果Active是running说明启动成功了
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-05-26 14:07:52 CST; 23s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 7264 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 7342 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─7342 /usr/sbin/mysqld