当前位置:   article > 正文

Host ‘localhost‘ is not allowed to connect to this MySQL server_host 'localhost' is not allowed to connect to this

host 'localhost' is not allowed to connect to this mysql server

Host ‘localhost’ is not allowed to connect to this MySQL server

方法1:

连接数据库,提示

#1130 Host ‘localhost’ is not allowed to connect to this MySQL server

1.首先停止mysql服务,如果不会可以直接停止所有wampserver。

2.然后打开一个命令行窗口,切换到mysql的安装目录,例如我的路径是:

cd C:\Program Files\MySQL\MySQL Server 5.5\bin

回车

mysqld --skip-grant-tables

回车

不要关闭CMD,随它放着

然后第一次可能会弹出对话框,允许访问

3.再打开一个命令行窗口

cd C:\Program Files\MySQL\MySQL Server 5.5\bin

mysql -u root -p

输入密码

use mysql;

delete from user where user=‘root’;

mysql> CREATE USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’; (注1)

mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ WITH GRANT OPTION;

mysql> CREATE USER ‘root’@’%’ ID

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/792457
推荐阅读
相关标签
  

闽ICP备14008679号