docker容器mysql授权一个新用户

问题描述:

成功运行mysql容器之后,进入了mysql,然后我们通过grant all privileges on *.* to 'reader' @'%' identified by '123456';新创建一个用户,允许任意ip等能够访问,但是报错了。
在这里插入图片描述

原因分析:

通过查询资料得知,是因为mysql8已经不支持一步到位了,而是需要分两步走才能够成功给用户授予权限。
在这里插入图片描述

解决方案:

mysql> create user 'reader'@'%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on *.* to 'reader'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)

猜你喜欢

转载自blog.csdn.net/qq_41486775/article/details/114271134
今日推荐