您的位置:首页 > 数据库 > MySQL

message from server: "Host xxx is not allowed to connect to this MySQL server的解決

2016-06-21 19:44 776 查看
解决方法: 
 
1. 改表法。 
 
可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%" 
 
mysql -u root -pvmwaremysql>use mysql;   www.2cto.com  
 
mysql>update user set host = '%' where user = 'root'; 
 
mysql>select host, user from user; 
 
2. 授权法。 
 
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。 
 
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 
 
FLUSH   PRIVILEGES; 
 
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码 
 
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;   www.2cto.com  
 
FLUSH   PRIVILEGES; 
 
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码 
 
GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 
 
FLUSH   PRIVILEGES; 
 
我用的第一个方法,刚开始发现不行,在网上查了一下,少执行一个语句 mysql>FLUSH RIVILEGES 使修改生效.就可以了 
 
另外一种方法,不过我没有亲自试过的,在csdn.net上找的,可以看一下. 
 
在安装mysql的机器上运行:   www.2cto.com  
 
1、d:\mysql\bin\>mysql   -h   localhost   -u   root //这样应该可以进入MySQL服务器 
 
2、mysql>GRANT   ALL   PRIVILEGES   ON   *.*   TO   'root'@'%'   WITH   GRANT   OPTION //赋予任何主机访问数据的权限 
 
3、mysql>FLUSH   PRIVILEGES //修改生效 
 
4、mysql>EXIT //退出MySQL服务器 
 
这样就可以在其它任何的主机上以root身份登录啦! 
 

更多相关文章

java.sql.SQLException: null, message from server: "Host xxx is not allowed to connect to this MySQL server"

java.sql.SQLException: null,  message from server: "Host 'xxx' is not allowed to connect to this MySQL server": 表示该对象不是远程对象,不能通过该对象远程访问数据 解决 ...

ERROR 1130: Host xxx is not allowed to connect to this MySQL server

在使用MySQL-Front连接mysql的时候发生的这个错误 ERROR 1130: Host xxx is not allowed to connect to this MySQL server 更改 mysql 数据库里的 user表里的 host项localhost改称% mysql -u

Host xxx is not allowed to connect to this MySQL server.

mysql开启远程连接 今天在服务器安装了mysql,准备用mysqlguitools远程登录的时候出错,提示:Host 'xxx' is not allowed to connect to this MySQL s

Host XXX is not allowed to connect to this MySQL server 解決方案/如何開啓MySQL的遠程帳號

  如何开启MySQL的远程帐号-1)首先以 root 帐户登陆 MySQL 在 Windows 主机中点击开始菜单,运行,输入“cmd”,进入控制台,然后cd 进入MySQL 的 bin 目录下,然后输入下面的命令

遠程連接mysql報錯1130 host 'localhost' is not allowed to connect to this mysql server

远程连接mysql时包如下错误: 1130 -host 'localhost' is not allowed to connect to this mysql server 解决辦法 本地用root账号登陆mysql




Host localhost is not allowed to connect to this MySQL server

Host 'localhost' is not allowed to connect to this MySQL server 解决方法 起因 系统本来就装了Mysql5.5版本,后来又装了一个WAMP,里面又一个MySQL5.1的.切换使用多了,就产生了误操作.试了一下网上大多的方法,好像都不行. ...

Mysql: XXX is not allowed to connect to this MySQL server

如果你想连接你的mysql的时候发生这个错误: ERROR 1130: Host '192.168.1.105' is not allowed to connect to this MySQL server 解决的方法有: 改表法 可能是你的帐号不允许从远程登陆,在服务器端的数据库中的 " ...

HOST ip is not allowed to connect to this MySql server

报错:1130-host ... is not allowed to connect to this MySql server解决方法:1. 改表法.可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql& ...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: