简体   繁体   English

OSX Docker / WordPress / MySQL —连接错误:(1130)不允许主机“ xxx.xxx.xxx.xxx”连接到此MariaDB服务器

[英]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: 我需要弄清楚的两件事是:

  1. "line 22" in what file? 什么文件中的“第22行”? Is this a config file? 这是配置文件吗? What is the file name? 文件名是什么?
  2. On a Mac/Docker deployment like this, what is the path to this file? 在这样的Mac / Docker部署中,此文件的路径是什么?

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.

相关问题 主机 'xxx.xx.xxx.xxx' 不允许连接到这个 MySQL 服务器 - Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server 如何修复 Laravel Sail“SQLSTATE[HY000] [1130] 主机 'XXX.XXX.XX' 不允许连接到此 MySQL 服务器”错误 - How to fix a Laravel Sail "SQLSTATE[HY000] [1130] Host 'XXX.XXX.X.X' is not allowed to connect to this MySQL server" error ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (60) 由外部访问引起 - ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (60) caused by external access SQLSTATE [HY000] [2003]无法连接到'XXX.XXX.XXX.XXX'上的MySQL服务器(60) - SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (60) 间歇性/随机`无法连接到'XXX.XXX.XXX.XXX'(60)上的MySQL服务器? - Intermittent/random `Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (60)`? 尝试从另一个容器访问mysql Docker容器时出现“不允许主机'192.XXX.XXX.X'连接到该MySQL服务器”错误 - “Host '192.XXX.XXX.X' is not allowed to connect to this MySQL server” error when attempting to access mysql Docker container from another container “不允许主机'xxx.x.xx.xx'连接到该MySQL服务器” - “Host 'xxx.x.xx.xx' is not allowed to connect to this MySQL server” 主机“ XXX”不允许连接到此MySQL服务器(V.8) - Host 'XXX' is not allowed to connect to this MySQL server (V.8) 未捕获的异常“ PDOException”-不允许主机“ xxx”连接到此MySQL服务器 - Uncaught exception 'PDOException' - Host 'xxx' is not allowed to connect to this MySQL server MySQL WorkBench 无法使用 root 用户 [Host to Vmware] 连接到位于 XXX.XXX.XXX 的 Mysql - MySQL WorkBench failed to connect to Mysql at XXX.XXX.XXX with user root [Host to Vmware]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM