当前位置:网站首页>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 .
边栏推荐
- docker安装及启动mysql服务
- Elsevier latex 提交文章 pdftex.def Error: File `thumbnails/cas-email.jpeg‘ not found: using draf
- 【PyG】理解MessagePassing过程,GCN demo详解
- MySql实战45讲【行锁】
- Node start server
- The series of hyperbolic function in daily problem
- 2020-01-01t00:00:00.000000z date format conversion
- Idea format code idea set shortcut key format code
- PAT乙级“1104 天长地久”DFS优化思路
- PHP constructor with parameters - PHP constructor with a parameter
猜你喜欢
![[MySQL] the difference between left join, right join and join](/img/d4/8684cd59cd1bd77e70bd4d7c7074c3.jpg)
[MySQL] the difference between left join, right join and join
![Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence](/img/60/bae0e8d92a53bcd2b2de3fb22b3b99.jpg)
Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence

Docker install MySQL

navicat 导出数据库的表结构

MySql实战45讲【全局锁和表锁】

Introduction to mongodb

Nasvit: neural architecture search of efficient visual converter with gradient conflict perception hypernetwork training
![Ansible introduction [unfinished (semi-finished products)]](/img/2a/0003daf761ba02d8837c4657fc3f29.png)
Ansible introduction [unfinished (semi-finished products)]

Don't use the new Dede collection without the updated Dede plug-in

为什么线程崩溃不会导致 JVM 崩溃
随机推荐
用Three.js做一个简单的3D场景
VS克隆时显示403错误
Find the storage address of the elements in the two-dimensional array
[mathematical logic] normal form (conjunctive normal form | disjunctive normal form | major item | minor item | maximal item | minor item | principal conjunctive normal form | principal disjunctive no
Hi3536c v100r001c02spc040 cross compiler installation
idea 加载不了应用市场解决办法(亲测)
基于QT的tensorRT加速的yolov5
Convert binary stream to byte array
PHP constructor with parameters - PHP constructor with a parameter
docker安装及启动mysql服务
MySql實戰45講【SQL查詢和更新執行流程】
Ansible简介【暂未完成(半成品)】
Vs Code configure virtual environment
com. fasterxml. jackson. databind. Exc.invalidformatexception problem
Spark on yarn资源优化思路笔记
Tidal characteristics of the Bohai Sea and the Yellow Sea
静态网页 和 动态网页的区别 & WEB1.0和WEB2.0的区别 & GET 和 POST 的区别
900w+ data, from 17s to 300ms, how to operate
Docker install redis
MySql实战45讲【行锁】