解决mysql的赋权操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION问题
Jiang_JY 人气:0一种情况
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;
加载全部内容