转自:http://www.cnblogs.com/wliang22/archive/2009/11/13/1602423.html
如果你想连接你的mysql的时候发生这个错误:
ERROR 1130: Host '210.13.92.66' is not allowed to connect to this MySQL server
请按照如下方法解决:
login as: root ///登陆系统
root@tqwm.cn's password: ///输入密码
Last login: Tue Apr 15 14:06:54 2008 from 210.13.92.66
[root@myserver ~]# /usr/local/mysql/bin/mysql -uroot -hlocalhost -p ///登入mysql
Enter password: ///输入mysql对应用户的密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 431
Server version: 5.0.58-enterprise-gpl-log Source
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. ///登入成功的提示信息
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'rootpasswd' WITH GRANT OPTION; ///输入这段指令并回车后允许所有用root用户并且输入rootpasswd密码的主机登入该mysql Server 如果将'%'换成'10.1.1.1'那么只有10.1.1.1的主机可以登陆.
Query OK, 0 rows affected (0.07 sec)
mysql> \q ///退出mysql
Bye
[root@myserver ~]#
另外还有一种方法转自其他地方
改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user = 'root';mysql>select host, user from user;
自己的解决方法:
直接在cmd 下进入mysql\bin 下 运行 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION