安装MySQL时Starting the server失败

安装时的日志如下:
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
Failed to connect to MySQL Server 8.0.28 after 10 attempts.
Ended configuration step: Starting the server

img

win+r打开运行,输入services.msc打开服务,找到安装MySQL时添加的服务名,一般8.0版本的MySQL默认是MySQL80,双击打开,登录选项卡下将选择的此账户改为选择本地系统账户。

img

错误提示:使用root无密码方式登录,尝试 访问Mysql@localhost,请确认下是否有创建 Mysql 用户并授权localhost访问?
Retry 10: Attempting to connect to Mysql@localhost:3306 with user root with no password...
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.

检查MySQL服务是否正常启动?
Failed to connect to MySQL Server 8.0.28 after 10 attempts.
Ended configuration step: Starting the server