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

Common failures and reasons for mysql connection failure

=================================================...

Detailed explanation of tinyMCE usage and experience

Detailed explanation of tinyMCE usage initializat...

React+axios implements github search user function (sample code)

load Request Success Request failed Click cmd and...

Instructions for recovering data after accidental deletion of MySQL database

In daily operation and maintenance work, backup o...

Two ways to completely delete users under Linux

Linux Operation Experimental environment: Centos7...

Detailed analysis of each stage of nginx's http request processing

When writing the HTTP module of nginx, it is nece...

Detailed Tutorial on Using xargs Command on Linux

Hello everyone, I am Liang Xu. When using Linux, ...

Detailed explanation of the correct use of the count function in MySQL

1. Description In MySQL, when we need to get the ...

Deploy Nginx+Flask+Mongo application using Docker

Nginx is used as the server, Mongo is used as the...

How to create a Pod in Kubernetes

Table of contents How to create a Pod? kubectl to...

Using zabbix to monitor the ogg process (Windows platform)

This article introduces how to monitor the ogg pr...

CSS realizes the scene analysis of semi-transparent border and multiple border

Scenario 1: To achieve a semi-transparent border:...

Detailed installation process of MySQL5.6.40 under CentOS7 64

MySQL5.6.40 installation process under CentOS7 64...

Detailed explanation of MySql slow query analysis and opening slow query log

I have also been researching MySQL performance op...