MySQL server version for the right syntax to use near 'identified


本文借鉴https://blog.csdn.net/shenhonglei1234/article/details/84786443
因为mysql升级到>8.0.13后, 授权指令要分开执行:

#创建账户(此例为root)
create user 'root'@'%' identified by  'password';

#赋予权限,with grant option这个选项表示该用户可以将自己拥有的权限授权给别人
grant all privileges on *.* to 'root'@'%' with grant option;

#改密码&授权超用户,flush privileges 命令本质上的作用是将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里
flush privileges;

还想在这一步骤中获取更多信息的话可以这样做:

查看某个用户的权限:
show grants for username@host; #用户名@主机

查看所有用户:
select host,user from mysql.user;

Mysql用户创建:
使用create user命令创建:
create user '用户名'@'主机' identified by '密码';

...
更多请见https://blog.51cto.com/11555417/2160730


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM