Skip to content

ER_HOST_NOT_PRIVILEGED: Host '172.19.0.3' is not allowed to connect to this MySQL server #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
UpCoder opened this issue Nov 13, 2016 · 3 comments

Comments

@UpCoder
Copy link

UpCoder commented Nov 13, 2016

I write a docker-compose that contains a website and a mysql
in my docker-compost, ,there write as follow:

version: '2.0'
services:
    website: 
        build: 
            context: /Users/Liang/Desktop/dockercompose/website/
            dockerfile: ./Dockerfile
        ports: 
            - "3001:3001" 
        links:
            - website_mysql:website_mysql
        depends_on:
            - website_mysql
        container_name: "website"
    website_mysql:
        build: 
            context: /Users/Liang/Desktop/dockercompose/mysql/
            dockerfile: ./Dockerfile
        container_name: "website_mysql"
        expose:
            - "3306"
        environment:
            - MYSQL_ROOT_PASSWORD="xA123456"

when I exec docker-compose up
there is a error when execute "npm start" in my website container. the error is a title.
maybe it caused by the remote access authority, but i don't know how to fix it
please help me, thank you very much

@tianon
Copy link
Member

tianon commented Nov 14, 2016

Is your node container configured to connect via root@website_mysql using xA123456 as the password?

It's probably also worth giving docker-library/postgres#203 (comment) a read through (good info about databases, volumes, and docker-compose in general, not specific to postgres).

@UpCoder
Copy link
Author

UpCoder commented Nov 15, 2016

It works now.but i forget i how to fix it😂😂 this is my now dockerfile as follow
mysql dockerfile:

FROM mysql:5.7
MAINTAINER [email protected]
#mysql config
ARG password=xA123456

ADD ./exec.sql /exec.sql
ADD ./exec.sql /docker-entrypoint-initdb.d/exec.sql
ADD ./mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
ENV MYSQL_ROOT_PASSWORD $password

EXPOSE 3306 

cnf is


[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

bind-address            = 0.0.0.0

key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log

expire_logs_days        = 10
max_binlog_size   = 100M

Thank you very much! 十分感谢🙏

@tianon
Copy link
Member

tianon commented Dec 10, 2016

Nice! 👍

@tianon tianon closed this as completed Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants