Data volume mysql mount

Data volume mysql mount

Download the mysql5.7 image

docker pull mysql:5.7

Run mirror

 //-d 后台运行
 //-p 端口映射
 //-v 卷挂载
 //-e 环境配置
 //--name 容器名
 docker run -d -p 3310:3306 -v /home/mysql/conf:/etc/mysql/conf.d -v /home/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql01 mysql:5.7

Connect to mysql to
Insert picture description here
Insert picture description here
view file mounting

cd /home/mysql
ll
cd data
ll

Insert picture description here
Insert picture description here
Create a new database test to
Insert picture description here
view the host mount

ll

Insert picture description here

Detection database persistence

After deleting the mysql container, the files mounted by the host will not be deleted
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45742032/article/details/111511205