您的位置:首页 > 数据库 > MySQL

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

2015-03-25 17:36 363 查看
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; 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐