mysql -u root -p #以权限用户root登录
mysql>use mysql; #选择mysql库
mysql>select * from user where user=‘root’; #查看mysql库中的user表的host值
mysql>update user set host = ‘%’ where user =‘root’; #修改host值
mysql>flush privileges; #刷新mysql表
mysql>select * from user where user=‘root’; #再次查看
再次测试成功连接