Host '***.***.***.***' is not allowed to connect to this MySQL server

其中***...是本机公网ip;

解决办法:

  1. 首先看报错窗口。

  2. 经查阅,错误原因是:本地IP(xxx.xxx.xxx.xxx)没有访问远程数据库的权限

    于是下面开启本地IP(xxx.xxx.xxx.xxx)对远程mysql数据库的访问权限。

  3. 首先远程连接进入服务器,在cms中输入mysql -u root -p,然后回车,输入密码后回车进入mysql命令行。

  4. 输入use mysql;

  5. 输入select user,password,host from user;

    可以看到host中只有localhost主机。我们需要将xxx.xxx.xxx.xxx也添加到这里才对。

  6. 添加方法如下:

    输入

    grant all privileges on *.* to root@"xxx.xxx.xxx.xxx" identified by "密码";

    这相当于是给IP-xxx.xxx.xxx.xxx赋予了所有的权限,包括远程访问权限。

    然后再输入

    flush privileges;

    这相当于是重新加载一下mysql权限,这一步必须有

  7. 再次输入select user,password,host from user;

    可以看到host中已经有了新加的IP。

  8. 现在再次用Navicat for MySQl访问远程mysql数据库,已经能正常打开了。

    问题解决。

  9. 不过还有一个问题,发现双击打开某张表的时候很慢,至少要3秒。

    原因是:

    当远程访问mysql时, mysql会解析域名, 所以会导致访问速度很慢, 会有2,3秒延时!

    解决办法:

    修改mysql安装目录下的my.ini,加上下面这个配置可解决此问题。在[mysqld]下加入:skip-name-resolve

    保存退出后重启mysql服务。

    然后访问速度就和本地一样快啦。

mysql不能链接远程,报(Host '***.***.***.***' is not allowed to connect to this MySQL server)的更多相关文章

  1. mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server

    mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server 如果你想连接你的mysql的时候发生这个错误: ERROR 1 ...

  2. mysql远程连接 Host * is not allowed to connect to this MySQL server(第一次配置好lnmp环境)

    1.第一次在linux上搭建好mysql,本机windows远程链接报错Host * is not allowed to connect to this MySQL server 2.原因:mysql ...

  3. 转:mysql远程连接 Host * is not allowed to connect to this MySQL server

    在本机登入mysql后,更改"mysql"数据库里的"user"表里的"host"项,从"localhost"改为'%' ...

  4. mysql远程连接 Host * is not allowed to connect to this MySQL server

    mysql -u root -p mysql>use mysql; mysql>update user set host =’%'where user =’root’; mysql> ...

  5. 账号不允许远程访问服务器上的mysql数据库的解决办法host is not allowed to connect to this mysql

    改表法.可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "use ...

  6. ERROR 1130: Host ’...′ is not allowed to connect to this MySQL server

    /******************************************************************** * ERROR 1130: Host ’...′ is no ...

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

    解决远程连接mysql错误1130代码的方法 今天在用远程连接Mysql服务器的数据库,不管怎么弄都是连接不到,错误代码是1130,ERROR 1130: Host 192.168.2.159 is ...

  8. MYSQL ERROR 1130: Host is not allowed to connect to this MySQL server

    今天安装MYSQL遇到MYSQL ERROR 1130: Host is not allowed to connect to this MySQL server, 试了很多办法都不行 skip-gra ...

  9. ‘Host’ is not allowed to connect to this mysql server

    ‘Host’ is not allowed to  connect to this mysql server mysql 数据库不允许远程连接 方法一:修改 host 表 进入mysql数据库,选择m ...

随机推荐

  1. The Flat Dictionary

    The Flat Dictionary 原来的代码没处理dict为空的情况 1 def flatten(dictionary): 2 #[] is a list 3 #() is a tuple 4 ...

  2. IE6 max-width max-height 不起作用 解决其兼容性问题

     .catelist dl dd ul li img {width: expression(this.width > 228 ? '228px': true); max-width:228px; ...

  3. 本地存储组件--兼容IE低版本

        在前端开发过程中,会用到本地缓存,但是由于浏览器对不同规范支持的程度不一样,每次进行使用都要为兼容行花费不少时间.我整理了一个本地存储的组件.     组件特点: 可以配置使用localSto ...

  4. python之路-模块 splinter

    Splinter介绍 Splinter is an open source tool for testing web applications using Python. It lets you au ...

  5. List数据集动态排序

    List<Type> datas = new List<Type>; datas = datas.OrderBy(c => c.GetType().GetProperty ...

  6. [Python学习笔记][第五章Python函数设计与使用]

    2016/1/29学习内容 第四章 Python函数设计与使用 之前的几页忘记保存了 很伤心 变量作用域 -一个变量已在函数外定义,如果在函数内需要修改这个变量的值,并将这个赋值结果反映到函数之外,可 ...

  7. css-下拉菜单案例

    <!DOCTYPE html>CSS4-布局2-display下拉菜单案例 <style>.xiala{width:200px;background:#ddd;}.xiala ...

  8. 8.0 BOM对象

    主要的掌握的知识结构图 1 Window 2 控制窗口.框架.弹出窗口 3 利用location对象中的页面信息 4 使用 navigator 对象了解浏览器 1.1 BOM的核心对象是window, ...

  9. jquery模拟checkbox效果,以及background-size在jquery中的使用。

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...

  10. Android--Toast时间

    /** * * 显示toast,自己定义显示长短. * param1:activity 传入context * param2:word 我们需要显示的toast的内容 * param3:time le ...