当前位置:网站首页>MySQL containerization (1) docker installation MySQL
MySQL containerization (1) docker installation MySQL
2022-07-03 08:20:00 【wangleleb】
1. Containerized MySQL The problem of
docker The container actually adds a read-write layer based on the image , When the container is deleted , The data state maintained by the container will be lost , about MySQL Such persistent data storage is catastrophic , At this time, the data persistence of the container is very necessary .
2. How to achieve persistence
In the last blog Docker Persistence It has been introduced in detail in , Readers can refer to .
3.MySQL Data source file for
Mysql Data files are generally stored in by default /var/lib/myql Next , The folders correspond to each database
# Among them wordpress The folder is my name wordpress Corresponding database
[email protected]:/var/lib/mysql# cd /var/lib/mysql && ls
auto.cnf client-key.pem ibdata1 private_key.pem sys
ca-key.pem ib_buffer_pool ibtmp1 public_key.pem wordpress
ca.pem ib_logfile0 mysql server-cert.pem
client-cert.pem ib_logfile1 performance_schema server-key.pem
Access to database
[email protected]:/var/lib/mysql# cd wordpress/ && ls
db.opt wp_options.frm wp_term_relationships.ibd wp_usermeta.frm
wp_commentmeta.frm wp_options.ibd wp_term_taxonomy.frm wp_usermeta.ibd
wp_commentmeta.ibd wp_postmeta.frm wp_term_taxonomy.ibd wp_users.frm
wp_comments.frm wp_postmeta.ibd wp_termmeta.frm wp_users.ibd
wp_comments.ibd wp_posts.frm wp_termmeta.ibd
wp_links.frm wp_posts.ibd wp_terms.frm
wp_links.ibd wp_term_relationships.frm wp_terms.ibd
[email protected]:/var/lib/mysql/wordpress#
Among them .frm The file is a table structure file .
Among them .ibd The file is a table data file .
4. adopt volume Realize database data persistence
- establish mysql Data volume
- establish mysql configure volumes ( Turn on binlog etc. )
- establish mysql Journal volume ( produce mysql journal )
docker volume create mysql-data \
docker volume create mysql-config \
docker volume create mysql-log
docker run -d -p 3306:3306 \
--name mysql \
-v mysql-data:/var/lib/mysql \
-v mysql-config:/etc/mysql/conf.d \
-v mysql-log:/var/log/mysql \
-e MYSQL_ROOT_PASSWORD=131452 \
mysql:5.7
Be careful : About Docker Persistent reference post
边栏推荐
- Conversion between string and int types in golang
- 【云原生】微服务之Feign的介绍与使用
- animation
- Un système de gestion de centre commercial pour la conception de cours de technologie d'application de base de données
- Encoding and decoding of golang URL
- Editor Extensions
- Shader foundation 01
- Haproxy+kept cluster setup 02
- Golang's range
- Haproxy+kept build 01
猜你喜欢

GIS实战应用案例100篇(七十八)-多规合一数据库设计及数据入库

Unity2019_ Lighting system

oracle 插入单引号

MAE

Basic operation and process control
![[global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel](/img/51/04f5a9dbd03438fbdf25545a81b7ba.jpg)
[global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel

Abstract classes and interfaces

一条通往服务器所有端口的隧道

MXone Pro自适应2.0影视模板西瓜视频主题苹果cmsV10模板

KunlunBase MeetUP 等您来!
随机推荐
链式长取值
Student educational administration management system of C # curriculum design
【更新中】微信小程序学习笔记_3
Data analysis exercises
Viz artist advanced script video tutorial -- stringmap use and vertex operation
One dimensional array two dimensional array (sort Max insert sort)
Kunlunbase meetup is waiting for you!
UE4 plug in development
Golang 中string和int类型相互转换
Minimap plug-in
Ventuz Foundation Series "one step at the door"
Redis data structure
Cesium service deployment, and import and display local 3dfiles data
ArrayList
Chain length value
Basic operation and process control 2
go 解析身份证
Compilation error: "not in executable format: file format not recognized"“
【云原生】微服务之Feign的介绍与使用
freetype库的移植