Docker starts MySQL configuration implementation process

Docker starts MySQL configuration implementation process

Preface

You can check how to start MySQL and some interpretations of MySQL on the official website. Attach the official website address

Start another mysql container instance and run the mysql command mysql is the world's most popular open source database. Because of its proven performance, reliability, and ease of use, MySQL has become the leading database choice for web-based applications, ranging from personal projects and websites, through e-commerce and information services, all the way to high-profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more.

Actual combat process

By checking the official website for specific white papers, you can find out that you can use this command to execute

insert image description here

This is the most basic way to start MySQL. However, since MySQL needs to be accessed via a port before it can be opened, this simple command only opens a container and a database container, but there is no entry access. You can add the parameters below the official website.

Let's start by explaining its main commands and details one by one

When using run -d to run in the background, if the MySQL container is not downloaded, it will automatically download the latest version. You can also docker search mysql
Get the image docker pull mysql
When running a container, you need to mount its files. You can mount multiple files with the following command:

-v /home/gaokaoli/usr/mydata/mysql/log:/var/log/mysql mounts the container's log folder to the corresponding location on the host -v /home/gaokaoli/usr/mydata/mysql/data:/var/lib/mysql mounts the container's data folder to the corresponding location on the host -v /home/gaokaoli/usr/mydata/mysql/conf:/etc/mysql/conf.d mounts the container's custom configuration folder to the corresponding location on the host

Other main parameters in the command are as follows:

-d Run in the background
-p port mount
-v volume mount can mount multiple
-e environment configuration setting password
--name container name

Finally, the mounted image command is

docker run -d -p 3306:3306 -v /home/gaokaoli/mysql/conf:/etc/mysql/conf.d -v /home/gaokaoli/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=12345678 --name mysql001 mysql

insert image description here

Check whether the startup is successful

insert image description here

The specific IP used to open the database through the Navicat software is the local IP address of the virtual machine instead of the address in the container

insert image description here

Conducting the test

insert image description here

The above is the details of the implementation process of Docker starting MySQL configuration. For more information about Docker starting MySQL configuration implementation, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • How to automatically execute SQL statements when MySQL in Docker starts
  • Execute initialization sql when docker mysql starts
  • Solution to MySQL initialization and startup failure in Docker
  • How to quickly start MySQL testing using Docker on Mac
  • How to initialize the Mysql database when the Docker container starts
  • Docker starts the mysql service implementation steps

<<:  Use a table to adjust the format of the form controls to make them look better

>>:  Detailed explanation of the 4 ways to import CSS files: inline, inline, external, and imported

Recommend

Can asynchrony in JavaScript save await?

I knew before that to synchronously obtain the re...

JavaScript ES new feature block scope

Table of contents 1. What is block scope? 2. Why ...

Detailed explanation of using Baidu style in eslint in React project

1. Install Baidu Eslint Rule plugin npm i -D esli...

3 ways to create JavaScript objects

Table of contents 1. Object literals 2. The new k...

Process analysis of deploying ASP.NET Core applications on Linux system Docker

Table of contents 1. System environment 2. Operat...

HTML table markup tutorial (9): cell spacing attribute CELLSPACING

A certain distance can be set between cells in a ...

How to connect to MySQL database using Node-Red

To connect Node-red to the database (mysql), you ...

Detailed examples of ajax usage in js and jQuery

Table of contents Native JS How to send a get req...

MySQL Series 8 MySQL Server Variables

Tutorial Series MySQL series: Basic concepts of M...

Nodejs global variables and global objects knowledge points and usage details

1. Global Object All modules can be called 1) glo...

Implementation of nested jump of vue routing view router-view

Table of contents 1. Modify the app.vue page 2. C...

Details of watch monitoring properties in Vue

Table of contents 1.watch monitors changes in gen...

Introduction to the use and difference between in and exists in MySQL

First put a piece of code for(int i=0;i<1000;i...

js implements a simple calculator

Use native js to implement a simple calculator (w...