当前位置:网站首页>Docker compose configures MySQL and realizes remote connection
Docker compose configures MySQL and realizes remote connection
2022-07-06 01:20:00 【PHP's gossip girlfriend】
You need to ensure that your operating environment meets the following requirements :
- Docker Engine
- Docker CLI
- Docker Compose
docker-compose.yml
version: '3.7'
services:
mysql:
image: "mysql/mysql-server:8.0"
environment:
TZ: "Asia/Shanghai"
MYSQL_ROOT_PASSWORD: "123456" # Set up root password
MYSQL_DATABASE: "library_manager" # Set up the database
MYSQL_USER: "library_manager" # The following items are connected Mysql When , Use this user name
MYSQL_PASSWORD: "123456"
ports:
- "33065:3306" # mapping , If you need a remote connection Docker Database in , This is an important step
volumes:
- mysql-data:/var/lib/mysql
- ./.github/init.sql:/docker-entrypoint-initdb.d/init.sql
restart: "always"
container_name: "mysql"
The effect of remote connection is as follows :
docker The configuration of the project in connecting to the database
environment:
APP_ENV: "${APP_ENV:-prod}"
DB_HOST: "mysql"
DB_PORT: "3306" # Because in the same environment , So just use 3306 Just port
DB_USERNAME: "library_manager"
DB_PASSWORD: "password"
DB_DATABASE: "database
边栏推荐
- [Yu Yue education] Liaoning Vocational College of Architecture Web server application development reference
- 关于softmax函数的见解
- Development trend of Ali Taobao fine sorting model
- Obstacle detection
- Unity VR resource flash surface in scene
- Kotlin basics 1
- Idea sets the default line break for global newly created files
- Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
- Yii console method call, Yii console scheduled task
- 95后CV工程师晒出工资单,狠补了这个,真香...
猜你喜欢
Hcip---ipv6 experiment
Vulhub vulnerability recurrence 74_ Wordpress
Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
SSH login is stuck and disconnected
普通人下场全球贸易,新一轮结构性机会浮出水面
Huawei converged VLAN principle and configuration
Condition and AQS principle
yii中console方法调用,yii console定时任务
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
2020.2.13
随机推荐
yii中console方法调用,yii console定时任务
How does Huawei enable debug and how to make an image port
ubantu 查看cudnn和cuda的版本
Recursive method converts ordered array into binary search tree
Exciting, 2022 open atom global open source summit registration is hot
Zhuhai laboratory ventilation system construction and installation instructions
How to get the PHP version- How to get the PHP Version?
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]
Huawei converged VLAN principle and configuration
BiShe - College Student Association Management System Based on SSM
Gartner发布2022-2023年八大网络安全趋势预测,零信任是起点,法规覆盖更广
leetcode刷题_验证回文字符串 Ⅱ
MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
Nmap: network detection tool and security / port scanner
伦敦银走势中的假突破
c#网页打开winform exe
Four commonly used techniques for anti aliasing
Vulhub vulnerability recurrence 75_ XStream
Cf:h. maximum and [bit operation practice + K operations + maximum and]
Introduction to robotics I. spatial transformation (1) posture, transformation