美文网首页
MySQL授权问题

MySQL授权问题

作者: 華華公子 | 来源:发表于2019-02-21 00:52 被阅读0次

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)

mysql>create user root@'%' identified by 'password';
mysql>grant all privileges on *.* to root@'%';
mysql>flush privileges;

相关文章

网友评论

      本文标题:MySQL授权问题

      本文链接:https://www.haomeiwen.com/subject/oirlyqtx.html