Cause:java.sql.SQLException: null, message from server: "Host '192.168.222.1' is not allowed to connect to this MySQL server"

在远程连接虚拟机上的mysql时,会报错:Host ‘192.168.222.1‘ is not allowed to connect to this MySQL server

原因:

  root用户只有在本机(127.0.0.1)可以登录

  Cause:java.sql.SQLException: null,  message from server: "Host '192.168.222.1' is not allowed to connect to this MySQL server"

解决办法:

  创建一个新用户,将Host字段值设为请求连接的用户IP,并为其附上权限

  Cause:java.sql.SQLException: null,  message from server: "Host '192.168.222.1' is not allowed to connect to this MySQL server"

 

   此时test1用户可以在任意电脑上连接并拥有的权限相当于root。

  

Cause:java.sql.SQLException: null, message from server: "Host '192.168.222.1' is not allowed to connect to this MySQL server"

上一篇:mysql主从同步+mycat读写分离+.NET程序连接mycat代理


下一篇:MySQL主从同步原理 部署【转】