解决mysql的赋权操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION问题

一种情况

mysql的赋权操作:GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;

mysql赋权操作:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

flush privileges;
GRANT:赋权命令
ALL PRIVILEGES:当前用户的所有权限
ON:介词
*.*:当前用户对所有数据库和表的相应操作权限
TO:介词
‘root’@’%’:权限赋给root用户,所有ip都能连接
IDENTIFIED BY ‘123456’:连接时输入密码,密码为123456
WITH GRANT OPTION:允许级联赋权

20200901:
将GRANT语句通过代码块包起来

二种情况

mysql中远程连接权限语句grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant optio报错

grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant optio

原因: mysql的版本问题,这条语句适用于MySQL8.0之前

解决: mysql8.0及以上版本需要使用以下语句:

create user root@'%' identified by '123456';
grant all privileges on *.* to root@'%' with grant option;

到此这篇关于mysql的赋权操作:GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;的文章就介绍到这了,更多相关mysql的赋权操作:GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

你可能感兴趣的:(解决mysql的赋权操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION问题)