Docker installs MySQL version 8.0.20 for your reference. The specific contents are as follows The first step is to pull down the image docker pull mysql:8.0.20 Step 2: Start the mirror docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0.20 Check whether the startup is successful docker ps -a After the third step is successfully started, enter the container and copy the configuration file to the host. docker cp mysql:/etc/mysql /mnt/sda1/mysql8.0.20 Copy the container's /etc/mysql directory to the host directory /mnt/sda1/mysql8.0.20 Step 4: Delete the mysql container and recreate it Stop the container first docker stop mysql Delete the container again docker rm mysql Step 5: Start MySQL, mount the configuration file, and persist the data to the host The startup script file name is mysql8.0.20.sh #!/bin/sh docker run \ -p 3306:3306 \ --name mysql \ --privileged=true \ --restart unless-stopped \ -v /mnt/sda1/mysql8.0.20/mysql:/etc/mysql \ -v /mnt/sda1/mysql8.0.20/logs:/logs \ -v /mnt/sda1/mysql8.0.20/data:/var/lib/mysql \ -v /etc/localtime:/etc/localtime \ -e MYSQL_ROOT_PASSWORD=123456 \ -d mysql:8.0.20 Command Explanation:
Step 6 : Execute the script to start the image sh mysql8.0.20.sh docker ps -a to see if it is started successfully Navicat connects to mysql to view the version number You are done ---- mounted data files and configuration files Congratulations on the successful installation. If you want to modify the configuration information of MySQL, just modify the mounted configuration file. Remember to restart after modification Stop mysql docker stop mysql Start mysql docker start mysql Wonderful topic sharing: MySQL different versions installation tutorial MySQL 5.7 installation tutorials for various versions MySQL 5.6 installation tutorials for various versions mysql8.0 installation tutorials for various versions The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Vue implements three-dimensional column chart based on echarts
>>: Detailed tutorial on how to deploy Springboot project using Nginx on the server (jar package)
How to install Linux CentOS 7.7 system in Vmware,...
What is CSS# CSS (abbreviation of Cascading Style...
Today, I logged into the server and prepared to m...
Preface This article mainly introduces the releva...
Preface When the code runs and an error occurs, w...
This time we will mainly learn about layout, whic...
1. Introduction A few days ago, a development col...
If the words in the sql statement conflict with t...
This technique comes from this article - How to a...
Preface During the development process, you will ...
A Thorough Analysis of HTML (14) Special Characte...
MySQL Views Simply put, a MySQL view is a shortcu...
Table of contents introduce 1. Pica 2. Lena.js 3....
Table of contents Preface 1. Basic Data 2. Inheri...
Table of contents 01 JavaScript (abbreviated as: ...