当前位置:网站首页>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
边栏推荐
- Distributed base theory
- Opinions on softmax function
- Fibonacci number
- Dynamic programming -- linear DP
- Leetcode sword finger offer 59 - ii Maximum value of queue
- Zhuhai's waste gas treatment scheme was exposed
- Idea sets the default line break for global newly created files
- JVM_ 15_ Concepts related to garbage collection
- A picture to understand! Why did the school teach you coding but still not
- Remember that a version of @nestjs/typeorm^8.1.4 cannot be obtained Env option problem
猜你喜欢

ThreeDPoseTracker项目解析

BiShe - College Student Association Management System Based on SSM

Loop structure of program (for loop)

ORA-00030

Kotlin basics 1
![Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]](/img/9e/c933f454a39d906a407e4d415f0b87.png)
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]

About error 2003 (HY000): can't connect to MySQL server on 'localhost' (10061)

3D模型格式汇总

95后CV工程师晒出工资单,狠补了这个,真香...

Ubantu check cudnn and CUDA versions
随机推荐
直播系统代码,自定义软键盘样式:字母、数字、标点三种切换
Recursive method converts ordered array into binary search tree
Unity VR solves the problem that the handle ray keeps flashing after touching the button of the UI
How to extract MP3 audio from MP4 video files?
Construction plan of Zhuhai food physical and chemical testing laboratory
Leetcode 剑指 Offer 59 - II. 队列的最大值
面试必刷算法TOP101之回溯篇 TOP34
Interview must brush algorithm top101 backtracking article top34
ORA-00030
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
电气数据|IEEE118(含风能太阳能)
95后CV工程师晒出工资单,狠补了这个,真香...
Leetcode1961. 检查字符串是否为数组前缀
A glimpse of spir-v
一圖看懂!為什麼學校教了你Coding但還是不會的原因...
Crawler request module
How to get the PHP version- How to get the PHP Version?
Kotlin basics 1
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]
Vulhub vulnerability recurrence 75_ XStream