mysql只能localhost连接,解决不允许其他机器去访问

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

登陆mysql 
首先 use mysql; 
按照别人提供的方式update的时候,出现错误。 
mysql> update user set host='%' where user = 'root'; 
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 
然后查看了下数据库的host信息如下: 
mysql> select host from user where user = 'root'; 

+-------------+------+

| host        | user |

+-------------+------+

| %           | root |

| 127.0.0.1   | root |

| MicroLetter |      |

| MicroLetter | root |

| localhost   |      |

+-------------+------+

host已经有了%这个值,所以直接运行命令: 
mysql>flush privileges; 

你可能感兴趣的:(java)