背景
电脑新装的mysql,版本为8.0以上。
分配权限时直接带密码和账号会报错。
grant all privileges on *.* to 'tome'@'%' identified by '123123';
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 '123123'' at line 1
解决方法
#先创建一个用户
create user 'tone'@'%' identified by '123123';
#再进行授权
grant all privileges on *.* to 'tone'@'%' with grant option;