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)
This article uses examples to illustrate the diff...
What is a table? It is composed of cell cells. In...
I am a beginner in SQL and thought that the insta...
question Recently I needed to log in to a private...
Our veteran predecessors have written countless c...
This article uses examples to describe how to cre...
Table of contents Preface Prepare Implementation ...
When writing a web project, I encountered an intr...
Generally, we rarely meet HR, but once we do, it c...
Table of contents Creating an SSL Certificate 1. ...
Background of the problem The server monitoring s...
introduction: Nowadays, many dynamic verification...
1. Modify the firewall configuration file # vi /e...
Introduction to sudo authority delegation su swit...
11. Use JavaScript to create page effects 11.1 DO...