新版SQL授权用户时报错 near 'IDENTIFIED BY '密码' with grant option' at line 1

1 问题:

当使用 grant 权限列表 on 数据库 to ‘用户名’@’访问主机’ identified by ‘密码’; 时会出现”……near ‘identified by ‘密码” at line 1”这个错误

2 原因:

因为新版的的mysql版本已经将创建账户和赋予权限的方式分开了

3解决办法:

创建账户:create user ‘用户名’@’访问主机’ identified by ‘密码’;

赋予权限:grant 权限列表 on 数据库 to ‘用户名’@’访问主机’ ;(修改权限时在后面加with grant option)

转载:https://blog.csdn.net/hxpjava1/article/details/86688662

邮箱: 1090055252@qq.com
原文地址:https://www.cnblogs.com/zhaoxianxin/p/13434048.html