linux中mysql授权问题

问题

mysql> grant all privileges on *.* to 'root'@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'root' with grant option' at line 1

解决

  8.0版本数据库已经不支持该语法

正确的写法是先创建用户
CREATE USER 'root'@'%' IDENTIFIED BY 'Hadoop3!';
再给用户授权
grant all privileges on *.* to 'root'@'%' ;

 

posted @ 2020-12-25 12:18  上天安排的最大嘛!  阅读(115)  评论(0编辑  收藏  举报