- mysql -u root -p # 先登录mysql
- use mysql # 切换到mysql这个数据库
- select host from user where user='root'; # 会发现root这个用户只有localhost权限
- update user set host = '%' where user ='root'; # 更改权限
- flush privileges; # 刷新数据库,成功解决
- mysql -u root -p # 先登录mysql
- use mysql # 切换到mysql这个数据库
- select host from user where user='root'; # 会发现root这个用户只有localhost权限
- update user set host = '%' where user ='root'; # 更改权限
- flush privileges; # 刷新数据库,成功解决