学习开源框架pig,使用navicat无法连接mysql
原因,如下图MySQL和Redis的端口没有开放
version: '3'
services:
pig-mysql:
build:
context: ./db
environment:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: root
restart: always
container_name: pig-mysql
image: pig-mysql
pig-redis:
image: redis:7.0.0
restart: always
container_name: pig-redis
hostname: pig-redis
pig-register:
build:
context: ./pig-register
restart: always
ports:
- 8848:8848
container_name: pig-register
hostname: pig-register
image: pig-register
加上端口:
version: '3'
services:
pig-mysql:
build:
context: ./db
environment:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: root
restart: always
container_name: pig-mysql
image: pig-mysql
ports:
- 3306:3306
pig-redis:
image: redis:7.0.0
restart: always
container_name: pig-redis
hostname: pig-redis
ports:
- 6379:6379
pig-register:
build:
context: ./pig-register
restart: always
ports:
- 8848:8848
container_name: pig-register
hostname: pig-register
image: pig-register