发布于 4年前

mysql8.0 解决ERROR 1064 (42000)报错

问题:最近开始用mysql8,结果发现在sql语法比之前的版本严格了许多。。此处先解决授权sql报错问题,报错如下

mysql> grant all on dev1\_test1.\* to dev1@'%' identified by '12345678';
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 '12345678'' at line 1

解决:mysql8 要求先建用户,后授权

# 新增用户、授权
mysql> create user admin@'%' identified by 'kFONVz22'; 

mysql> GRANT all on *.* TO admin@'%';

mysql> flush privileges;

# 取消授权
 msyql> revoke all ON *.*  FROM admin@'%';
©2020 edoou.com   京ICP备16001874号-3