我正在使用 docker-compose 运行一个 docker 堆栈。docker-compose.yml 如下所示。问题是如果我添加默认用户 root 那么它工作正常但是将用户更改为另一个用户说tara会引发错误。
我再说一遍: 适用于用户:root
注意我在具有单个副本的 3 个节点上运行它。因此该服务可能在任何节点上运行。
"SQLSTATE[HY000] [1130] Host '10.0.10.6' is not allowed to connect to this MySQL server (SQL: select count(*) as aggregate from `users` where `email` = ramesh@gm ▶"
这是 docker-compose.yml
版本:'3.3'
网络:smstake:ipam:配置:-子网:10.0.10.0/24
服务:
db:
image: mysql:5.7
networks:
- smstake
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: smstake
MYSQL_USER: tara
MYSQL_PASSWORD: password
deploy:
mode: replicated
replicas: 1
app:
image: smstake:latest
ports:
- 8000:80
networks:
- smstake
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
phpmyadmin:
image: phpmyadmin/phpmyadmin
networks:
- smstake
environment:
PMA_HOST: db
PMA_PORT: 3306
MYSQL_USER: tara
MYSQL_PASSWORD: password
ports:
- '8082:80'
deploy:
mode: replicated
replicas: 1
卷:db_data:
所有 3 项服务都在运行,只是连接问题。
人们建议运行授权命令,但我可以在哪里以及如何使这些命令运行?