Answer the question
In order to leave comments, you need to log in
How to get from a docker container to a remote Mysql host?
nginx+php+mysql containers are deployed, the site works fine on them, but when trying to connect to a remote database, an error occurs
[email protected]:/# mysql -u user -p*** -h 192.168.58.233
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.58.233' (111)
mysql:
build: ./mysql
container_name: mysql
volumes_from:
- source
ports:
- '${INTERFACE}:3306:3306'
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
command: mysqld --sql-mode=""
Answer the question
In order to leave comments, you need to log in
I did not understand the question. But I think here is your answer - refer to the name of the container, in this case it is mysql, i.e. if you type mysql:3306 inside the machines, then connect to mysql, nginx - nginx will open, remove ports, there is no point in forwarding them outside
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question