当前位置:网站首页>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
边栏推荐
猜你喜欢
Mall management system of database application technology course design
MXone Pro自适应2.0影视模板西瓜视频主题苹果cmsV10模板
數據庫應用技術課程設計之商城管理系統
十六进制编码简介
P1596 [USACO10OCT]Lake Counting S
Editor Extensions
unity2019_ Input management
How to establish rectangular coordinate system in space
Base64和Base64URL
Haproxy+kept build 01
随机推荐
Wpf: solve the problem that materialdesign:dialoghost cannot be closed
About Wireshark's unsuccessful installation of npcap
Generate video using clipout in viz engine
Base64和Base64URL
[updating] wechat applet learning notes_ three
P1896 [scoi2005] non aggression (shape pressure DP)
Classes and objects
详解sizeof、strlen、指针和数组等组合题
tslib库的移植
Yolo series --- xml2txt script
Exe file running window embedding QT window
Zohocrm deluge function application time verification
P1596 [USACO10OCT]Lake Counting S
Ventuz Foundation Series "one step at the door"
Puhua PLM empowers the whole scene product lifecycle management and helps the enterprise digital transformation of the main line of products
Osgearth north arrow display
MXone Pro自适应2.0影视模板西瓜视频主题苹果cmsV10模板
A tunnel to all ports of the server
unity2019_ Input management
Image processing 8-cnn image classification