右击开始图标,打开“命令提示符(管理员)”。

1、输入代码,停止服务。 

net stop MySQL57         // 我的MySQL是57版本的

2、转到mysql的bin目录下。

3、输入代码,启动mysql 跳过权限。

mysqld --skip-grant-tables
//执行到这里就只会有光标在一闪一闪无法继续写命令或输入任何命令,故重新再打开一个cmd窗口

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

4、再打开一个CMD,再次转到mysql的根目录下

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

 5、输入代码,进入mysql。

mysql

 6、输入代码,刷新数据库。

flush privileges;

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

 7、输入代码,使用mysql数据库。

 use mysql  
//可以看到user表

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

 8、输入代码,查看本地用户。

select Host,User,authentication_string from user;

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

9、输入代码把root用户的Host修改为%。

update user set host = '%' where user ='root';

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

 10、返回mysql连接页面,登录成功。

Mysql连接本地报错:1130-host ... is not allowed to connect to this MySQL server解决

总结

原文地址:https://blog.csdn.net/m0_46527351/article/details/127426455

相关文章:

  • 2021-06-05
  • 2021-04-03
  • 2022-01-14
  • 2021-08-13
  • 2021-04-22
  • 2021-11-26
  • 2021-07-15
猜你喜欢
  • 2021-09-26
  • 2021-09-27
  • 2021-10-14
  • 2021-04-24
  • 2021-05-08
  • 2018-06-09
  • 2021-10-10
  • 2021-08-20
相关资源
相似解决方案