当前位置:网站首页>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
边栏推荐
- 3D模型格式汇总
- 282. Stone consolidation (interval DP)
- Unity | two ways to realize facial drive
- Cf:h. maximum and [bit operation practice + K operations + maximum and]
- Mysql--- query the top 5 students
- BiShe - College Student Association Management System Based on SSM
- 朝招金安全吗 会不会亏损本金
- Yii console method call, Yii console scheduled task
- Building core knowledge points
- Leetcode1961. 检查字符串是否为数组前缀
猜你喜欢

1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once

VSphere implements virtual machine migration

MUX VLAN configuration

The growth path of test / development programmers, the problem of thinking about the overall situation

Condition and AQS principle

Study diary: February 13, 2022

Building core knowledge points

DOM introduction

ubantu 查看cudnn和cuda的版本

测试/开发程序员的成长路线,全局思考问题的问题......
随机推荐
面试必刷算法TOP101之回溯篇 TOP34
ThreeDPoseTracker项目解析
Recoverable fuse characteristic test
Recursive method to realize the insertion operation in binary search tree
Introduction to robotics I. spatial transformation (1) posture, transformation
视频直播源码,实现本地存储搜索历史记录
Test de vulnérabilité de téléchargement de fichiers basé sur dvwa
Condition and AQS principle
Some features of ECMAScript
Obstacle detection
Logstash clear sincedb_ Path upload records and retransmit log data
Five challenges of ads-npu chip architecture design
在产业互联网时代,将会凭借大的产业范畴,实现足够多的发展
WGet: command line download tool
Opinions on softmax function
In the era of industrial Internet, we will achieve enough development by relying on large industrial categories
Paging of a scratch (page turning processing)
ClickOnce 不支持请求执行级别“requireAdministrator”
Is chaozhaojin safe? Will it lose its principal
Leetcode1961. 检查字符串是否为数组前缀