Skip to content

Instantly share code, notes, and snippets.

@qichunren
Created December 9, 2011 03:38
Show Gist options
  • Save qichunren/1450038 to your computer and use it in GitHub Desktop.
Save qichunren/1450038 to your computer and use it in GitHub Desktop.
MySQL server提示信息,不能远程连接数据库。
安装完MySQL后,远程连接数据库的时候,出现 ERROR 1130 (HY000): Host '192.168.0.32'is not allowed to connect to this MySQL server提示信息,不能远程连接数据库。
于是在网上搜了下
用下面的方法解决:
这个时候只要在MySQL服务器上登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"(或新增一条记录),正式环境建议指定为应用服务器的IP地址,比如'192.168.0.32'。
mysql -u root -pvmware
mysql>use mysql;
mysql>update user set host = '%' where user = 'root'; //这个命令执行错误时可略过
mysql>flush privileges;
mysql>select host, user from user;
mysql>quit
退出后会回到DOS正常的提示符状态,此时可以通过远程连接Mysql了!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment