MySQL8创建用户与授权时分开的,如果使用MySQL5的授权方式会出现以下错误:
#创建账户(% 代表所有IP)
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;