mysql配置远程连接方法之一(改表法)

1、问题:如果在远程连接报错:1130-host ... is not allowed to connect to this MySql server,可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

2、解决方法:

  (1)update user set host = '%' where user = 'root';

  (2)报错:ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 

  (3)mysql> flush privileges; 直接运行,然后连接成功

原文地址:https://www.cnblogs.com/timothy-lai/p/5976256.html