热线电话:13121318867

登录
2018-11-01 阅读量: 946
MySQL8.0创建用户和授权

在mysql8.0创建用户和授权和之前不太一样了,其实严格上来讲,也不能说是不一样,只能说是更严格,mysql8.0需要先创建用户和设置密码,然后才能授权。

#先创建一个用户
create user 'hong'@'%' identified by '123123';

#再进行授权
grant all privileges on *.* to 'hong'@'%' with grant option;

如果还是用原来5.7的那种方式,会报错误:

grant all privileges on *.* to 'sroot'@'%' 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

0.0000
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子