当前位置:网站首页>Docker install and start MySQL service
Docker install and start MySQL service
2022-07-03 03:27:00 【Water W】
Catalog
1.docker install mysql
Premise : Make sure your server is installed docker
(1) Enter the command , see docker,
docker info
or
docker version
(2) And then we go into docker hub Officials go to download what they want mysql Mirror image Docker Hub
Search for mysql,

(3) find office edition ,

Click to enter , You can see docker install mysql The order is :
docker pull mysql
(4) On the server linux Run this command in , install mysql,
docker pull mysql
(5) Run the following command to detect mysql Download successful or not ,
docker images
(6) Run the following command to start mysql service , After successful startup, a container is returned ID.
docker run --name mysql-ytz -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /root/data:/var/lib/mysql mysql:latest
explain :
1:--name mysql-ytz: The name of the container after it is started :( Custom naming ) If not set , The system will automatically set a .
-d Start the service on behalf of the background .
2:-p 3306( This is a liunx Port number , The host machine , If we want remote service , The access port is this port ):3306(docker The port of the container , Each container is independent , It can be understood as a system at the operating system level ), To access this port is to remotely access the port of the host first , Then map to docker Port access of the container mysql.
3:-e MYSQL_ROOT_PASSWORD=123456 This is to say mysql Startup password required for startup , The default account number is root , The password is set above :123456
4: -v /root/data:/var/lib/mysql /root/data/: This is the data storage path of the host ( You can also customize it ),
5: /var/lib/mysql: This is a mysql Where containers store data . Also for synchronizing data , prevent , After the container is deleted , The data doesn't exist .
6: Version number
2. Connect to database
(7) Finally, connect to the database , I was in navicat Connected in ,
- Connection name : I started it myself
- host :ip Address , Local localhost
- port : The port number is the same as that in the previous command , The general default is 3306
docker run --name mysql-ytz -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /root/data:/var/lib/mysql mysql:latest- user name :root
- password : Use the password set by the previous command
docker run --name mysql-ytz -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /root/data:/var/lib/mysql mysql:latest

After the connection , The database appears ,

OK, This means that the connection is connected .
边栏推荐
- Nasvit: neural architecture search of efficient visual converter with gradient conflict perception hypernetwork training
- Avec trois. JS fait une scène 3D simple
- Hi3536c v100r001c02spc040 cross compiler installation
- Find the storage address of the elements in the two-dimensional array
- Basic operations of mongodb [add, delete, modify, query]
- 渤、黄海的潮汐特征
- Stepping on pits and solutions when using inputfilter to limit EditText
- Vs 2019 configuration du moteur de génération de tensorrt
- Mongodb replication set [master-slave replication]
- Bigvision code
猜你喜欢
![MySQL practice 45 [global lock and table lock]](/img/23/fd58c185ae49ed6c04f1a696f10ff4.png)
MySQL practice 45 [global lock and table lock]

用Three.js做一个简单的3D场景

Lvgl usage experience
![Ansible introduction [unfinished (semi-finished products)]](/img/2a/0003daf761ba02d8837c4657fc3f29.png)
Ansible introduction [unfinished (semi-finished products)]
![45 lectures on MySQL [index]](/img/f6/70be00028908cbd9ed7f2c77687cee.png)
45 lectures on MySQL [index]

VS 2019配置tensorRT

Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)

el-tree搜索方法使用
![[MySQL] the difference between left join, right join and join](/img/d4/8684cd59cd1bd77e70bd4d7c7074c3.jpg)
[MySQL] the difference between left join, right join and join

FileZilla Client下载安装
随机推荐
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions
VS克隆时显示403错误
The XML file generated by labelimg is converted to VOC format
umi 路由拦截(简单粗暴)
45 lectures on MySQL [index]
com.fasterxml.jackson.databind.exc.InvalidFormatException问题
900w+ data, from 17s to 300ms, how to operate
The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
静态网页 和 动态网页的区别 & WEB1.0和WEB2.0的区别 & GET 和 POST 的区别
Hi3536C V100R001C02SPC040 交叉编译器安装
C # general interface call
Advanced redis applications [password protection, data persistence, master-slave synchronization, sentinel mode, transactions] [not completed yet (semi-finished products)]
Convert binary stream to byte array
VS 2019 配置tensorRT生成engine
Idea format code idea set shortcut key format code
UMI route interception (simple and rough)
VS 2019安装及配置opencv
Node start server
Why does thread crash not cause JVM crash
Limit of one question per day