WAMP 64bit
安装好后,连接数据库,提示
#1130 Host 'localhost' is not allowed to connect to this MySQL server
1.首先停止mysql服务,如果不会可以直接停止所有wampserver。
2.然后打开一个命令行窗口,切换到mysql的安装目录,例如我的路径是:
cd C:\wamp\bin\mysql\mysql5.1.36\bin
回车
mysqld --skip-grant-tables
回车
不要关闭CMD,随它放着
然后第一次可能会弹出对话框,允许访问
3.再打开一个命令行窗口
cd C:\wamp\bin\mysql\mysql5.1.36\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'@'%' IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
注1:
会提示:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe
解决办法,在命令行输入:mysql> flush privileges;