问题现象:本机连接远程环境的mysql数据库报错,提示本机ip无法连接到mysql服务器。

  问题原因:本机对远程mysql数据库没有访问权限。

  解决方法:在远程mysql数据库添加本机ip的访问权限:

  1、登陆远程mysql,这里的用户名和密码都是root

[root@izwz932ypmamm80m434qqyz ~]# mysql -uroot -proot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5.-log MySQL Community Server (GPL) by Atomicorp Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  2、进入mysql数据库,查询用户表

mysql> use mysql;
Database changed
mysql> select user,password,host from user;
+------+-------------------------------------------+-------------------------+
| user | password | host |
+------+-------------------------------------------+-------------------------+
| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost |
| root | | izwz932ypmamm80m434qqyz |
| root | | 127.0.0.1 |
| root | | :: |
| | | localhost |
| | | izwz932ypmamm80m434qqyz |
+------+-------------------------------------------+-------------------------+
rows in set (0.00 sec)

  3、添加本机ip(这里为117.149.10.46),用户名密码还是设置为root

mysql> grant all privileges on *.* to root@"117.149.10.46" identified by "root";
Query OK, rows affected (0.00 sec) mysql> select user,password,host from user; +------+-------------------------------------------+-------------------------+
| user | password | host |
+------+-------------------------------------------+-------------------------+
| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost |
| root | | izwz932ypmamm80m434qqyz |
| root | | 127.0.0.1 |
| root | | :: |
| | | localhost |
| | | izwz932ypmamm80m434qqyz |
| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 117.149.10.46 |
+------+-------------------------------------------+-------------------------+
rows in set (0.00 sec)

  4、重新加载mysql的访问权限

mysql>flush privileges;

  本机重新连接远程mysql成功。

本地连接远程环境mysql报错:Host'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server的更多相关文章

  1. 报错 "Host '192.168.209.1' is not allowed to connect to this MySQL server"

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/weixin_37632381/artic ...

  2. Navicat 连接远程数据库报错:1130 - Host "XX.XX.XX.XX" is not allowed to connect to this MySQL server

    Navicat 连接远程数据库报错:1130 - Host "XX.XX.XX.XX" is not allowed to connect to this MySQL server ...

  3. Mysql远程连接报错:SQL Error (1130): Host '192.168.61.128' is not allowed to connect to this MySQL server

    Mysql远程连接报错:SQL Error (1130): Host '192.168.0.18' is not allowed to connect to this MySQL server     ...

  4. Mysql远程连接报错:SQL Error (1130): Host '192.168.6.128' is not allowed to connect to this MySQL server

    通过SQLyog连接linux中的MySQL报错问题:SQL Error (1130): Host '192.168.6.128' is not allowed to connect to this ...

  5. 通过navicat连接mysql服务器提示SQL Error (1130): Host '192.168.1.100' is not allowed to connect to this MySQL server

    新装一个mysql,尝试用通过navicat连接mysql服务器的时候提示: SQL Error (1130): Host '192.168.1.100' is not allowed to conn ...

  6. MySQL 1130 - Host 127.0.0.1 is not allowed to connect to this MySQL server

    在开发中为了让开发更方便,在本地配置环境,希望可以直接访问服务器上的MySQL数据库,更方便的管理数据库, 需要在本地远程连接linux服务器的本地数据库,直接用数据库管理工具连接出现如下报错1130 ...

  7. SQL Error (1130): Host '192.168.1.126' is not allowed to connect to this MySQL server

    通过HeidiSQL连接MYSQL数据库报错: SQL Error (1130): Host '192.168.1.126' is not allowed to connect to this MyS ...

  8. ERROR 1130 (HY000): Host '172.16.1.54' is not allowed to connect to this MySQL server

    centos7.5 远程连接数据库报错 问题: [root@db04-54 ~]# mysql -urep -p123 -h172.16.1.51 Warning: Using a password ...

  9. MYSQL错误1130:ERROR 1130: Host 10.10.36.115 is not allowed to connect to this MySQL server

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

  10. 解决ERROR 1130: Host '192.168.11.1' is not allowed to connect to this MySQL

    使用navicat进行远程登录MySQL时,报出 ERROR 1130: Host '192.168.11.1' is not allowed to connect to this MySQL  se ...

随机推荐

  1. 高亮显示UILabel中的子串

    I. 用户在搜索框中,输入关键字进行检索时,APP对搜索结果进行显示,有以下两种情况: 1. 匹配一次,如检索关键字为人名 这种情况,实现比较容易.写一个UILabel的category, 用rang ...

  2. 用idea编译器写第一个Java程序——步骤

  3. Ubuntu中idea配置guns

    idea配置guns Tips:建议JDK1.8的包 sudo update-alternatives --config java 设置默认的java # java -version java ver ...

  4. 详解Django自定义过滤器

    django过滤器的本质是函数,但函数太多了,为了显示自己的与众不同,设计者们想了个名字过滤器... django有一些内置的过滤器,但和新手赛车不多(把字母转成小写,求数组长度,从数组中取一个随机值 ...

  5. 报错如HTTP Status 404 - /ssh_crm/jsp/linkman/add.jsp/

    明显是写错了, HTTP Status 404 - /ssh_crm/jsp/linkman/add.jsp/ 应该改成 HTTP Status 404 - /ssh_crm/jsp/linkman/ ...

  6. nyoj-1316-二分

    acm.nyist.edu.cn/JudgeOnline/problem.php?pid=1316题目链接 Interval 时间限制:2000 ms  |  内存限制:65535 KB 难度:3 描 ...

  7. cf 814C 思维

    http://codeforces.com/contest/814/problem/C 给定一个字符串s,长度小于1500,进行q次询问q<=20w,每次询问输入一个m和一个字符c,求将最多m个 ...

  8. axios 讲解 和vue搭建使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. 用Spring和c3p0工具简单的实现增删改查

    1.导入Spring和c3p0的jar包 2.配置beans.xml文件 <?xml version="1.0" encoding="UTF-8"?> ...

  10. LeetCode OJ:Perfect Squares(完美平方)

    Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 1 ...