首页 > 数据库技术 > 详细

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

时间:2014-11-20 18:29:45      阅读:307      评论:0      收藏:0      [点我收藏+]

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

表示该对象不是远程对象,不能通过该对象远程访问数据

解决:

方案一:改表:

use mysql ;select user,host,password from user;

update user set host = ‘%‘ where user=‘root‘;

方案二:授权法:

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。 
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION; 
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码 
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.1.3‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;

 

需要重启mysql数据库。

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

原文:http://www.cnblogs.com/lanliying/p/4111004.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!