mysql8版本执行 grant all privileges on *.*  to  ‘root‘@‘%‘  identified by ‘root‘  with grant option; 会报错

mysql8版本执行 grant all privileges on *.*  to  'root'@'%'  identified by 'root'  with grant option;
会报语法错误  ERROR 1064 (42000)
 

应先创建新用户
create user 'admin'@'%' identified by 'password';

执行授权

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%';

刷新
flush privileges;

授权远程

ALTER USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

刷新
flush privileges;


版权声明:本文为java_cai_niao_han原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。