赞
踩
连接数据库,提示
#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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。