解决mysql的赋权操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION问题
Posted shengyin714959
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决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@
以上是关于解决mysql的赋权操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION问题的主要内容,如果未能解决你的问题,请参考以下文章
Mysql grant all privileges on ...不生效解决方案