not allowed to connect to this MySQL server

<p>在用Navicat配置远程连接Mysql数据库时遇到如下报错信息,这是由于Mysql配置了不支持远程连接引起的。</p><p><img src="/up_pic/201901/120953578321.jpg" title="120953578321.jpg" alt="1.jpg"/></p><p>在安装Mysql数据库的主机上登录root用户:</p><p>mysql -u root -p</p><p><img src="/up_pic/201901/120954058555.jpg" title="120954058555.jpg" alt="2.jpg"/></p><p>依次执行如下命令:</p><p>use mysq;</p><p>select host from user where user=&#39;root&#39;;</p><p>可以看到当前主机配置信息为localhost.</p><p><img src="/up_pic/201901/120954135930.jpg" title="120954135930.jpg" alt="3.jpg"/></p><p>执行update user set host = &#39;%&#39; where user =&#39;root&#39;将Host设置为通配符%。</p><p>Host设置了&quot;%&quot;后便可以允许远程访问。</p><p><img src="/up_pic/201901/120954492648.jpg" title="120954492648.jpg" alt="7.jpg"/></p><p><img src="/up_pic/201901/120954568736.jpg" title="120954568736.jpg" alt="4.jpg"/></p><p>Host修改完成后记得执行flush privilegs使配置立即生效。</p><p><img src="/up_pic/201901/120955216652.jpg" title="120955216652.jpg" alt="5.jpg"/></p><p>完成以上操作后,再试尝试远程连接Mysql,报错信息消失。如果再次连接出现2059报错信息,可以参考以下经验解决。</p><p>2如何修复mysql 8.0.11连接报错2059?</p><p><img src="/up_pic/201901/120955251686.jpg" title="120955251686.jpg" alt="6.jpg"/></p>
RangeTime:0.007534s
RangeMem:205.06 KB
返回顶部 留言