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;