给mysql用户添加远程访问权限
MySQL8.0之前语句:
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
MySQL8.0之后语句:
create user admin@'%' identified by '123456';
grant all privileges on *.* to admin@'%' with grant option;
GRANT:赋权命令
ALL PRIVILEGES:当前用户的所有权限
.:当前用户对所有数据库和表的相应操作权限
‘root’@’%’:权限赋给root用户,所有ip都能连接
IDENTIFIED BY ‘123456’:连接时输入密码,密码为123456
WITH GRANT OPTION:允许级联赋权