1 问题描述Docker 启动MySQL 容器后,创建一个localhost 访问的用户:
create user test@localhost identified by 'test'; 但是在宿主机中无法通过该用户登录: 
2 原因在Docker 中的MySQL 创建localhost 的用户只能在Docker 内部访问,而不能通过外部访问。 至于为什么能在宿主机访问root ,是因为默认存在两个root ,分别是: 
而test 只有一个localhost : 
3 解决方案创建test@% 或者创建test@172.17.0.1 即可: create user test@% identified by 'test';create user test@172.17.0.1 identified by 'test'; 下载地址: kubernetes集群搭建Zabbix监控平台的详细过程 docker中mysql开启日志的实现步骤 |