1、登录MySQL
mysql -uroot -p
2、进入 名为"mysql"的数据库
use mysql
3、修改user表的host
update user set host = ‘%‘ where user = ‘root‘;
select host, user from user;
4、刷新MySQL的系统权限相关表
Flush Privileges;
5、授权给远程ip
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION
其他:grant all privileges on *.* to xiaoming@120.163.25.1 identified by ‘123456‘;
给来自120.163.25.1的用户xiaoming分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123456。
6、刷新MySQL的系统权限相关表
Flush Privileges;