Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Docker starts the mysql service

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how Docker starts mysql service". In daily operation, I believe many people have doubts about how Docker starts mysql service. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how Docker starts mysql service". Next, please follow the editor to study!

1: make sure your server has docker installed

Input

Docker info or docker version

2: then we go to docker hub to download our desired mysql image.

Find the version of offic and click to enter

3: put it into linux to execute after command.

[root@iZ2zehajf73atd9gbz1qdbZ redisconf] # docker pull mysql:5.6

4: then check whether the download is successful: docker images

5:docker run-- name some-mysql-d-p 3306 MYSQL_ROOT_PASSWORD=123456-v / root/data:/var/lib/mysql mysql:5.6

Now explain the command parameters:

1:--name some-mysql: the name of the container after startup: (custom naming) if it is not set, the system will automatically set one. After all, if you open too many containers, it will be embarrassing if you can't remember them. It is recommended to add the meaning of the name.

2Remod starts the service on behalf of the background

3docker liunx p 3306 (this is the port number of docker, which I used to say is the host. If we want remote services, this is the port to access): 3306 (the port of the docker container, each container is independent, which can be understood as a system at the operating system level). To access this port is to access the host by remotely, and then map it to the port of the mysql container.

4root MYSQL_ROOT_PASSWORD=123456 this is the boot password needed to start mysql. The default account is root, and the password is set above: 123456

5Murv / root/data:/var/lib/mysql / root/data/: this is the data storage path of the host (you can also customize it), / var/lib/mysql: this is where the mysql container stores the data. It is also to synchronize the data to prevent the data from being deleted after the container is deleted.

6: return a container ID after the startup is successful

7: finally, you can connect.

At this point, the study on "how Docker starts the mysql service" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report