[英]OSX Docker/WordPress/MySQL — Connection Error: (1130) Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MariaDB server
This question is different than other similar questions because it involves running in a Docker container on OS X , which has previously been running fine for a week, and is now failing. 这个问题与其他类似的问题不同,因为它涉及在OS X上的Docker容器中运行,该容器以前已经运行了一周,现在却失败了。
Following the instructions here: 请按照此处的说明进行操作:
https://medium.com/@tatemz/local-wordpress-development-with-docker-3-easy-steps-a7c375366b9 https://medium.com/@tatemz/local-wordpress-development-with-docker-3-easy-steps-a7c375366b9
I was able to get a local WordPress install up and running very quickly and it's been wonderful. 我能够很快安装并运行本地WordPress,这真是太好了。
Today when I start it up, there is a connection refusal that looks like it would be very simple to address if I could figure out two things from the following error messages: 今天,当我启动它时,如果我能从以下错误消息中找出两件事,则似乎很容易解决连接拒绝:
MySQL Connection Error: (1130) Host '172.19.0.3' is not allowed to connect to this MariaDB server
Warning: mysqli::mysqli(): (HY000/1130): Host '172.19.0.3' is not allowed to connect to this MariaDB server in - on line 22
The 2 things I need to figure out are: 我需要弄清楚的两件事是:
The docker container directory only contains a WordPress install directory. docker容器目录仅包含WordPress安装目录。 There doesn't appear to be anything related to MySQL/MariaDB in that directory.
该目录中似乎没有与MySQL / MariaDB相关的任何内容。 I've read through a lot of documentation on Mac deployments of MySQL and where the config files would live, but being in a Docker container this is a different beast.
我已经阅读了很多有关MySQL的Mac部署以及配置文件所在位置的文档,但是在Docker容器中,这是另一回事。 The documentation I have found does not apply.
我找到的文档不适用。
I have looked into SSH'ing into a Docker container (I'm a baby at Docker) but I don't even know if that's a thing you do. 我已经研究过将SSH导入Docker容器(我是Docker的孩子),但我什至不知道这是否是您要做的事情。
Your issue is probably with the MySQL container starting before the WordPress container. 您的问题可能是MySQL容器在WordPress容器之前开始。 Try adding the depends_on tag to your docker-compose.yml file and remove the links tag.
尝试将depends_on标签添加到您的docker-compose.yml文件中,然后删除链接标签。 You also want to add restart: always to both containers.
您还想添加重新启动:始终对两个容器。
my-wp:
image: wordpress
volumes:
- ./:/var/www/html
depends_on:
- my-wpdb
restart: always
ports:
- "8080:80"
environment:
WORDPRESS_DB_PASSWORD: ChangeMeIfYouWant
You can take a look at your error logs by running: 您可以通过运行以下命令查看错误日志:
docker logs -f CONTAINERNAME >/dev/null
If you want to open up a shell inside your container, you can run: 如果要在容器内打开外壳,可以运行:
docker exec -ti CONTAINERNAME /bin/bash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.