一.问题描述

之前mysql服务好好的,突然无法启动了。
win10系统,64位,mysql8.0.23

二.问题解决

1.mysqld --console命令查看具体报错

C:\WINDOWS\system32>mysqld --console
2021-08-12T02:05:11.959508Z 0 [System] [MY-010116] [Server] D:\D1\java\mysql-8.0.23-winx64\bin\mysqld.exe (mysqld 8.0.23) starting as process 42052
2021-08-12T02:05:11.963063Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-08-12T02:05:11.989396Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-08-12T02:05:12.581028Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-08-12T02:05:13.026667Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2021-08-12T02:05:13.169785Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-08-12T02:05:13.170995Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-08-12T02:05:13.181345Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: 通常每个套接字地址(  议/网络地址/端口)只允许使用一次。
2021-08-12T02:05:13.185920Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2021-08-12T02:05:13.207636Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-08-12T02:05:14.310478Z 0 [System] [MY-010910] [Server] D:\D1\java\mysql-8.0.23-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.23)  MySQL Community Server - GPL.

error信息大意是3306端口被占用了

2.查询端口被什么占用并杀死这个进程
注:
taskkill命令几个常用的参数:
/f表示强制终止
/pid指定终止进程的pid
还有一个/t参数表示终止指定的进程
和任何由此启动的子进程

C:\WINDOWS\system32>netstat -ano | findstr 3306
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       7124
  TCP    0.0.0.0:33060          0.0.0.0:0              LISTENING       7124
  TCP    [::]:3306              [::]:0                 LISTENING       7124
  TCP    [::]:33060             [::]:0                 LISTENING       7124

C:\WINDOWS\system32>taskkill /f /pid 7124
成功: 已终止 PID 为 7124 的进程。

3.再次启动mysql

C:\WINDOWS\system32>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐