I hope you could help me.
I'm trying to setup a docker with multiple MySQL container in ubuntu server.
docker-compose.yml
version: '3.1' services: mysql-db_1: image: mysql:8.0.28-debian command: --sql_mode="" --default-authentication-plugin=mysql_native_password restart: always ports: - '3306:3306' volumes: -./data_1/files:/var/lib/mysql-files -./data_1/data:/var/lib/mysql mysql-db_2: image: mysql command: --sql_mode="" --default-authentication-plugin=mysql_native_password restart: always ports: - '3307:3307' volumes: -./data_2/files:/var/lib/mysql-files -./data_2/data:/var/lib/mysql
Everything is successfully built and I was able to connect to port 3306 however I can't connect to port 3307.
Your mysql-db_2
container port is invalid.
you can change it to 3307:3306
so it will be exposed at port 3307, but the container itself will be listening on port 3306
mysql-db_2: image: mysql command: --sql_mode="" --default-authentication-plugin=mysql_native_password restart: always ports: - '3307:3306' volumes: -./data_2/files:/var/lib/mysql-files -./data_2/data:/var/lib/mysql
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.