Skip to content

MySQL Connection Error: (1130) Host 'xxx.xx.x.x' is not allowed to connect to this MySQL server #152

@Zeychiel

Description

@Zeychiel

Hi,

I'm trying to get [a wordpress container linked to a mysql container] and [a website linked to his api linked to its db] behind a reverse proxy nginx (using jwilder's solution), all on the same cluster on a ECS instance.

I have tried the 'usual way' of doing it, equivalent to :

forum:
  image: wordpress:latest
  working_dir: /var/www/html
  links:
   - forumdb:mysql
  volumes:
    - $GOPATH//wordpress/wp-content/:/var/www/html/wp-content
  environment:
    WORDPRESS_DB_PASSWORD: password
    VIRTUAL_HOST: forum.docker.dev
forumdb:
  image: mysql:latest
  restart: always
  environment:
    MYSQL_ROOT_PASSWORD: password
    MYSQL_DATABASE: wordpress

and tried adding WORDPRESS_DB_USER not to use the root, but unsuccesfully ; I always get those errors :

MySQL Connection Error: (1130) Host '172.17.0.8' is not allowed to connect to this MySQL server
Warning: mysqli::mysqli(): (HY000/1130): Host '172.17.0.8' is not allowed to connect to this MySQL server in - on line 10

The Host IP can change when I rerun the containers.

In the MySQL container I have :

mysql> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+

I used those docker images several months ago, without any trouble ; my understanding is that now the default conf doesn't authorize the WP container to connect to the db as it is not on localhost, as it is in another container .
Do I understand it right ?
What is the right solution to get this work ?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions