新创建了一个本地MySQL数据库用户,然后再创建连接再创建数据库发现失败,且提示:Access denied…,于是求得是创建该用户时权限未分配,于是用

grant all privileges on *.* to `账号`@`localhost` identified by `密码` 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 `llewyn@2022` with grant option' at line 1

,开始以为是各处标点符号没写正确,全部都改了还是报错。

最终分析得:
MySQL8的权限修改语句已经改成:

 GRANT ALL PRIVILEGES ON *.* TO 'localuser'@'localhost' WITH GRANT OPTION;

无需再后面添加

identified by `密码`