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. TypeError: not enough arguments for format string

    到一个问题,表示100% 的时候,出现这个问题. 因为python语法会认为是你需要转移符,这个时候你可以选择100%% 来表示

  2. hdu 4578 Transformation

    http://acm.hdu.edu.cn/showproblem.php?pid=4578 题意:1,a,b,c代表在a,b区间的每一个数加上c:2,a,b,c代表在a,b区间的每一个数乘上c: 3 ...

  3. BZOJ 1061 志愿者招募

    http://www.lydsy.com/JudgeOnline/problem.php?id=1061 思路:可以用不等式的改装变成费用流. 将不等式列出,如果有负的常数,那么就从等式连向T,如果是 ...

  4. PowerShell 中进行列表展示的排序-倒序

    Order Your Output by Easily Sorting Objects in PowerShell ★★★★★ ★★★★ ★★★ ★★ ★ January 10, 2012 by Th ...

  5. 转:Asp.Net MVC中DropDownListFor的用法

    在Asp.Net MVC中可以用DropDownListFor的方式来让用户选择已定列表中的一个数值.用法不复杂,这里简单做一个记录. 首先我们要定义一个 Model ,用户在 DropDownLis ...

  6. Roman to Integer && Integer to Roman 解答

    Roman Numeral Chart V:5 X:10 L:50 C:100 D:500 M:1000 规则: 1. 重复次数表示该数的倍数2. 右加左减:较大的罗马数字右边记上较小的罗马数字,表示 ...

  7. POJ-2533最长上升子序列(DP+二分)(优化版)

    Longest Ordered Subsequence Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 41944   Acc ...

  8. fcntl,F_GETFL,F_SETFL,flags

    1.获取文件的flags,即open函数的第二个参数: flags = fcntl(fd,F_GETFL,0); 2.设置文件的flags: fcntl(fd,F_SETFL,flags); 3.增加 ...

  9. hdu 5641 King's Phone(暴力模拟题)

    Problem Description In a military parade, the King sees lots of new things, including an Andriod Pho ...

  10. ACM—Number Sequence(HDOJ1005)

    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1005 主要内容: A number sequence is defined as follows: f ...