How to Allow MySQL Client to Connect to Remote MySQ

By default, MySQL does not allow remote clients to connect to the MySQL database.

If you try to connect to a remote MySQL database from your client system, you will get “ERROR 1130: Host is not allowed to connect to this MySQL server” message as shown below.

$ mysql -h 192.168.1.8 -u root -p Enter password: ERROR 1130: Host '192.168.1.4' is not allowed to connect to this MySQL server

You can also validate this by doing telnet to 3306 mysql port as shown below, which will also give the same “host is not allowed to connect to this mysql server” error message as shown below.

$ telnet 192.168.1.8 3306 host 192.168.1.4 is not allowed to connect to this mysql server

If you want to allow a specific client ip-address (for example: 192.168.1.4) to access the mysql database running on a server, you should execute the following command on the server that is running the mysql database.

$ mysql -u root -p Enter password: mysql> use mysql mysql> GRANT ALL ON *.* toroot@'192.168.1.4' IDENTIFIED BY 'your-root-password'; mysql> FLUSH PRIVILEGES;

Also, update firewall rules to make sure port# 3306 is open on the server that is running the mysql database.

After the above changes, when you try to connect to the mysql database from a remote client, you’ll not get the “Host is not allowed to connect to this MySQL server” error message anymore.

If you want to allow all clients to connect you may do following

GRANT ALL ON *.* to root@’%’ ;

How to Allow MySQL Client to Connect to Remote MySql的更多相关文章

  1. mysql Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

    mysql Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ 今天在linux中安装了mys ...

  2. Mysql -- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’解决方法

    启动mysql 报错: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/m ...

  3. mysql,Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) "

    # mysql -uroot -pEnter password:ERROR 2002 (HY000): Can't connect to local MySQL server through sock ...

  4. 解决mysql:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

    (一)出现问题的的报错信息 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) ( ...

  5. mysql Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    错误原因:/var/lib/mysql目录中socket文件不存在.连接mysql服务器有两种方式:tcp连接,通过socket文件连接.通过socket文件,启动mysql服务,mysql服务会自动 ...

  6. 配置远程连接mysql数据库 Connect to remote mysql database

    设有本地机器(local machine), ip地址为localip 远程机器(remote machine), ip地址remoteip 要通过在local machine的终端连接remote ...

  7. mysql: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    https://www.cnblogs.com/jpfss/p/9734487.html (mysql.sock错误解决方案)

  8. 连接Mysql提示Can’t connect to local MySQL server through socket的解决方法

    mysql,mysqldump,Mysqladmin,php连接mysql服务常会提示下面错误: ERROR 2002 (HY000): Can't connect to local MySQL se ...

  9. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    有时候,当我们使用"mysql"."mysqladmin"."mysqldump"等命令管理数据库时,服务器抛出类似如下错误: 一.错误现场 ...

随机推荐

  1. 前端AJAX传递数组给Springmvc接收处理

    前端传递数组后端(Spring)来接收并处理: <!DOCTYPE html> <html> <head> <meta charset="UTF-8 ...

  2. linux笔记:文件系统管理-分区、文件系统以及文件系统常用命令

    linux分区类型: linux文件系统: df(查看文件系统容量和占用): du(统计文件或目录大小): 查询和自动挂载: 挂载命令格式: 挂载光盘: 卸载光盘: 挂载U盘:

  3. tiny_cnn 阅读(1)

    从今天起, 我会每天把阅读tiny_cnn的阅读心得提交到博客园中希望大家在这个平台上可以多多交流: 关于如果阅读代码? 抓住重点,忽略细节 首先打开从github上下载的文件: 通过csdn和网上搜 ...

  4. css知识点积累

    关于样式的优先级问题: !important > style > [ id > class > tag ];  z-index 的属性用法: z-index属性是用来设置元素的 ...

  5. curl请求的时候总是提示400

    今天用curl测试一个接口,一直提示400 最后发现是url的问题,如下处理就可以了 $url = str_replace(' ', '+', $url);

  6. ExtJS 刷新后,默认选中刷新前最后一次选中的节点

          在对树节点进行操作后往往需要进行reload操作刷新一下树,但是很多业务都需要在树形刷新后默认选中最后一次选中的节点.这样就必须先保存前一次选中节点的信息,在reload之后再次通过节点的 ...

  7. Python collections 模块用法举例

    Python作为一个“内置电池”的编程语言,标准库里面拥有非常多好用的模块.比如今天想给大家 介绍的 collections 就是一个非常好的例子. 1.collections模块基本介绍 我们都知道 ...

  8. windows 7 32bit安装 python3.5.0 安装错误 0x80240017 -未指定错误

    日志显示如下: [0F60:03D4][2015-10-20T10:47:52]i001: Burn v3.10.0.1823, Windows v6.1 (Build 7600: Service P ...

  9. sql like in 语句获取以逗号分割的字段内的数据

    From:http://www.cnblogs.com/goody9807/archive/2011/07/27/2118107.html sql中的某个字段用“,”分隔数据,需要获取数据的时候直接把 ...

  10. PostgreSQL的9.4已经发布(译)

    http://www.postgresql.org/about/news/1557/ 2014年12月18日,PostgreSQL全球开发小组发布PostgreSQL9.4,PostgresQL是世界 ...