当前位置:网站首页>Who has docker to install MySQL locally?

Who has docker to install MySQL locally?

2022-07-07 07:58:00 Wu_ Candy

introduction

When developing projects or scripts on personal computers , We often encounter the problem of data storage , In our work project Mysql It is a common business database , If you want to store data , Except for installing on our personal computers Mysql Is there no other choice for service ?

No,No, You can also choose not to install on your own computer Mysql Services can also solve data storage problems .

That is to use Docker Start a Mysql service , The development program can pass Host, Port Direct connection , Then start to increase at will , Delete , Change , Check the business data you created !

Today's share :

No local installation required Mysql service , Use Docker Super fast start Mysql Services realize data storage !

Operation steps

1. install Docker

Enter official website (https://www.docker.com/) Download the appropriate according to the operating system Docker edition , After downloading and installing successfully , The following whale icon will appear on the desktop .

2. start-up Docker

Double click the whale icon , After startup Docker The interface is as follows :

The two menus on the left are :

  • Containers/Apps

  • Images

Containers/Apps: Indicates that the container service has been started

Images: Indicates an existing local image , The list shown in the following figure shows the images I have pulled locally

3.Docker Pull Mysql Mirror image

Pull Mysql The latest version of the mirroring command :

docker pull mysql # No addition :latest By default, the latest version of the image is pulled 
docker pull mysql:latest

Pull Mysql Specify the version mirroring command :

docker pull mysql:8.0.18

Search for Mysql Available version mirroring commands :

docker search mysql

4. View local image

docker images

You can see from the picture that you just pulled Mysql The image has been transferred to the local image list

5. Start the container

docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql

Parameter description :

  • -p 3306:3306 : Mapping container service's 3306 Port to host 3306 port , External hosts can go directly through The host machine ip:3306 Access to the MySQL Service for .

  • MYSQL_ROOT_PASSWORD=123456: Set up MySQL service root User's password .

  • mysql-test: Indicates the name of the container started , This name can be customized

A long string container will be returned if the normal container is successfully started id, As shown in the figure above .

6. Check the container process started

docker ps

In addition to the command line window, you can view , You can also use the launched desktop version Docker To view the , As shown in the figure below

7.Navicat Tool connection Mysql service

(1). Use Navicat Tool connection just used Docker Container enabled Mysql service

According to the parameters set by the startup container , stay Navicat New China Mysql Connect

(2). see Mysql Database under

Summary

1. The program code can easily connect this Mysql service Increase data , Delete , Change , check .

2. Use Docker To start up Mysql The service saves local installation Mysql Steps for , relatively speaking Relatively light and fast .

Welcome to your attention 【 The way of immeasurable testing 】 official account , reply 【 Claim resources 】

Python+Unittest frame API automation 、

Python+Unittest frame API automation 、

Python+Pytest frame API automation 、

Python+Pandas+Pyecharts Big data analysis 、

Python+Selenium frame Web Of UI automation 、

Python+Appium frame APP Of UI automation 、

Python Programming learning resources dry goods 、

Vue Front end component framework development 、

Resources and code Free ~
Below the official account is two-dimensional code. , You can directly scan wechat and pay attention .

remarks : My official account has been officially opened. , betake IT Sharing of Internet technology .

contain : Data analysis 、 big data 、 machine learning 、 Test Development 、API Interface automation 、 Test operation and maintenance 、UI automation 、 Performance testing 、 code detection 、 Programming technology, etc .

WeChat search official account :“ The way of immeasurable testing ”, Or scan the qr code below :

 Insert picture description here    

  Add the attention , Let's grow together !

原网站

版权声明
本文为[Wu_ Candy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070431334220.html