1. 授权用户root使用密码jb51从任意主机连接到mysql服务器:
代码如下:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'jb51' WITH GRANT OPTION;
flush privileges;
2.授权用户root使用密码jb51从指定ip为218.12.50.60的主机连接到mysql服务器:
代码如下:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'218.12.50.60' IDENTIFIED BY 'jb51' WITH GRANT OPTION;
flush privileges;
mysql8.0
创建用户
create user 'anycloud'@'192.168.50.85' identified by 'anycloud';
添加权限
grant all privileges on *.* to 'tone'@'%' with grant option;