java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
来源:互联网 发布:江苏省网络文学院 编辑:程序博客网 时间:2024/05/16 14:41
<article> <h1 class="csdn_top">java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect</h1> <div class="article_bar clearfix"> <div class="artical_tag"> <span class="original">原创</span> <span class="time">2015年12月23日 10:32:20</span> </div><ul class="article_tags clearfix csdn-tracking-statistics" data-mod="popu_377" style="display: none;"><li class="tit">标签:</li></ul> <ul class="right_bar"> <li><button class="btn-noborder"><i class="icon iconfont icon-read"></i><span class="txt">3164</span></button></li> <!--<li><button class="btn-noborder"><i class="icon iconfont icon-dashang-"></i><span class="txt">0</span></button></li>--> <li class="edit" style="display: none;"> <a class="btn-noborder" href="http://write.blog.csdn.net/postedit/50385057"> <i class="icon iconfont icon-bianji"></i><span class="txt">编辑</span> </a> </li> <li class="del" style="display: none;"> <a class="btn-noborder" onclick="javascript:deleteArticle(fileName);return false;"> <i class="icon iconfont icon-shanchu"></i><span class="txt">删除</span> </a> </li> </ul> </div> <div id="article_content" class="article_content csdn-tracking-statistics" data-mod="popu_519" data-dsm="post"> <p><span style="font-size:12px"><span style="white-space:pre"></span>因为公司需要把项目和数据库分开进行,所以有2台服务器,直接修改连接池ip后,出现了</span><span style="font-size:12px; font-family:'Microsoft YaHei',微软雅黑,Arial,'Lucida Grande',Tahoma,sans-serif; line-height:22px">ava.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect这样的错误,它的意思就是安装了数据库的服务器不允许部署项目的服务器进行远程连接。也就是权限问题,修改权限就可以了,修改方法是。</span></p><p><span style="font-size:12px; font-family:'Microsoft YaHei',微软雅黑,Arial,'Lucida Grande',Tahoma,sans-serif; line-height:22px"><span style="white-space:pre"></span>找到user表,这个可以通过工具找,因为我的远程连接工具是Navicat,user表就在这里<img src="http://img.blog.csdn.net/20151223103730674?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">打开user表,<img src="http://img.blog.csdn.net/20151223103819026?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">比如我这里项目用的用户名是bjtf,那么就把bjtf的Host改成%,就可以了,之后还要执行一下执行刷新权限:flush privileges(它的执行就像sql语句一样执行就可以了);步骤也可以这样操作:</span></p><p><span style="font-family:'Microsoft YaHei',微软雅黑,Arial,'Lucida Grande',Tahoma,sans-serif; line-height:22px"><span style="font-size:12px">在mysql的bin目录下执行:mysql -uroot -p密码 登陆到数据:<br>执行use mysql;<br>select host,user,password from user;<br>可以看到user为root,host为localhost的话,说明mysql只允许本机连接,那么外网,本地软件客户端就无法连接了。<br>调整方法:<br>执行:update user set host='%' where user ='root';<br>执行刷新权限:flush privileges;<br>可以测试外网连接mysql服务器。</span><br></span></p><p><span style="font-size:12px; font-family:'Microsoft YaHei',微软雅黑,Arial,'Lucida Grande',Tahoma,sans-serif; line-height:22px"><span style="white-space:pre"></span></span></p><div><span style="font-size:12px; font-weight:normal"><span style="white-space:pre"></span></span></div><link rel="stylesheet" href="http://static.blog.csdn.net/public/res-min/markdown_views.css?v=2.0"> </div> </article>
阅读全文
0 0
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect异常解决
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
- 远程mysql_java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQ
- java.sql.SQLException: null, message from server: "Host '192.168.1.101' is not allowed to connect
- Mysql报错java.sql.SQLException:null,message from server:"Host '27,45,38,132' is not allowed to connect
- message from server: "Host 'xxx' is not allowed to connect to this MySQL server"
- MySQL:message from server: "Host xxx is not allowed to connect to this MySQL server"
- message from server: "Host 'xxx' is not allowed to connect to this MySQL server的解决
- null, message from server: "Host ***" is not allowed to connect to this MySQL server"
- ActivityManagerService总结
- 多元函数的泰勒(Taylor)展开式
- 工业物联网提高了全球的工厂生产效率
- JavEE 报错compiler level does not match the version of the installed java project facet解决方法
- CPU对存储器的读写
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
- retrofit数据返回类型不统一解析方法
- NetworkUtil
- LeetCode-Remove Duplicates from Sorted Array
- LA 3415 Guardian of Decency (二分图最大独立集)
- CSS 伪元素选择器
- 提高MySQL性能的7个技巧
- ajax的文件上传
- Switch推出自己的数据中心标准