MySQL安装问题:MySQL error 1042: Unable to connect to any of the specified MySQL hosts

时间:2024-03-26 17:43:50

在安装MySQL的最后一步发生了如下错误:
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
MySQL安装问题:MySQL error 1042: Unable to connect to any of the specified MySQL hosts
有两种解决办法

第一种,治标不治本,win+r打开运行,输入services.msc打开服务,找到安装MySQL时添加的服务名,一般8.0版本的MySQL默认是MySQL80,双击打开,登录选项卡下将选择的此账户改为选择本地系统账户。
MySQL安装问题:MySQL error 1042: Unable to connect to any of the specified MySQL hosts
应用确定之后再执行就没问题了,不过这种办法在每次重装MySQL之后都需要操作一次。
MySQL安装问题:MySQL error 1042: Unable to connect to any of the specified MySQL hosts
另一个办法是配置组策略,这是windows的权限管理带来的问题,步骤如下:
右击此电脑–>管理–>本地用户和组–>组–>双击Administrators–>添加–>高级
把NETWORK SERVICE添加到Administrators组