解决mysql8 提示 ERROR 1410 (42000): You are not allowed to create a user with GRANT
小虾米
阅读:1964
2021-03-31 16:57:12
评论:0
今天为创建的root 用户授予相关权限提示如下错误:
mysql> grant all privileges on test.* to root@'%' identified '123456';
提示如下错误:ERROR 1064(4200): you have an error in you SQL syntax; **near 'identified '123456'' at line 1
查询MySQL8 相关授权资料的得知,分配权限不能带密码。
修改后的指令如下:
mysql > grant all privileges on test.* to root@'%'
提示的错误信息如下:You are not allowed to create a user with GRANT;
产生用户不能授权的原因是mysql 数据库中user 表中的特定用户(root) 的host 的属性值为localhost.
解决办法如下:
# 使用mysql 数据库
mysql > use mysql;
# 特定用户的host 修改
mysql > update user set host='%' where user='root';
# 指定用户的授权
mysql > grant all privileges on test.* to root@'%'
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。