gpt4 book ai didi

mysql 5.7 无法允许 CentOS7 上的 docker IP 访问

转载 作者:行者123 更新时间:2023-11-29 11:24:32 26 4
gpt4 key购买 nike

我已经在CentOS 7.1上安装了Mysql5.7和docker服务。本地使用mysql -u root命令连接mysql就可以了。但是当我尝试使用mysql -u root -h 172.17.0.1时却无法连接,其中172.17.0.1是本地docker0 ip地址。

[root@test1 workspace]# mysql -u root -h 172.17.0.1
ERROR 1130 (HY000): Host 'test1.novalocal' is not allowed to connect to this MySQL server

我已经通过 Google 搜索了原因,并尝试授予对 test1.novalocal 的访问权限,但运气不佳。

mysql> grant all on *.* to root@'test1.novalocal' with grant option;
ERROR 1133 (42000): Can't find any matching row in the user table

还有其他线索吗?

最佳答案

尝试:

grant all on *.* to 'root'@'test1.novalocal' identified by 'somepassword' with grant option;

MySQL最新版本带有NO_AUTO_CREATE_USER其中

Prevent the GRANT statement from automatically creating new users if it would otherwise do so, unless authentication information is specified. The statement must specify a nonempty password using IDENTIFIED BY or an authentication plugin using IDENTIFIED WITH.

您可以disable如果需要使用空白密码,请使用此模式!

MySQL Workbench 甚至发出警告

0 row(s) affected, 1 warning(s): 1287 Using GRANT for creating new user is deprecated and will be removed in future release.

您可能需要CREATE a user before GRANT在未来的版本中。

关于mysql 5.7 无法允许 CentOS7 上的 docker IP 访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38457901/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com