当前位置:网站首页>Implementation steps of docker deploying mysql8
Implementation steps of docker deploying mysql8
2022-07-07 03:44:00 【1024 questions】
One 、 Pre demand
Two 、 Deployment method
3、 ... and 、 Access test
One 、 Pre demand1.linux System
I use the Centos7
2. install docker
Refer to this article
Two 、 Deployment method1. Pull mysql8 Mirror image
docker pull mysql:8
2. Create profile mount directory and data mount directory
mkdir -p /usr/mysql/conf /usr/mysql/datachmod -R 755 /usr/mysql/
ps:
/home/mysql/config: discharge mysql The configuration file my.conf
/home/mysql/data: discharge mysql data
3. create profile
vim /usr/mysql/conf/my.cnf
The contents are as follows
[client]#socket = /usr/mysql/mysqld.sockdefault-character-set = utf8mb4[mysqld]#pid-file = /var/run/mysqld/mysqld.pid#socket = /var/run/mysqld/mysqld.sock#datadir = /var/lib/mysql#socket = /usr/mysql/mysqld.sock#pid-file = /usr/mysql/mysqld.piddatadir = /usr/mysql/datacharacter_set_server = utf8mb4collation_server = utf8mb4_binsecure-file-priv= NULL# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Custom config should go here!includedir /etc/mysql/conf.d/
4. Start the container and mount the directory
docker run --name mysql8 --restart=always -v /usr/mysql/conf/my.cnf:/etc/mysql/my.cnf -v /usr/mysql/data:/var/lib/mysql -v /etc/localtime:/etc/localtime:ro -p 4706:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8
ps:
-v /usr/mysql/conf/my.cnf:/etc/mysql/my.cnf Native MySQL The configuration file is mapped to the container MySQL The configuration file
-v /etc/localtime:/etc/localtime:ro The local time is synchronized with the database time
–restart=always When restarting Docker The container will be started automatically
-d : Background operation
-p Port mapping Host port number : Container port number
-e Environmental parameters ,MYSQL_ROOT_PASSWORD Set up root User's password
docker run -p 60306:3306 -e MYSQL_ROOT_PASSWORD=123 -v /etc/my.cnf:/etc/mysql/my.cnf:rw -v /etc/localtime:/etc/localtime:ro --name mysql8 --restart=always -dit mysql
5. Get into mysql Create user
<1> Into the container
docker exec -it mysql8 /bin/bash
<2> Get into mysql
mysql -uroot -p123456
<3> Create user
I'll create one here called python Users of
# establish python user , The password for 123456, Allow login on any machine CREATE USER 'python'@'%' IDENTIFIED BY '123456';
<4> To give permission
# give python The user is in On all machines Yes All databases and data tables Have All operation rights GRANT ALL ON *.* TO 'python'@'%';
3、 ... and 、 Access test Successful connection
This is about Docker Deploy Mysql8 This is the end of the article on the implementation steps of , More about Docker Deploy Mysql8 Please search the previous articles of software development network or continue to browse the relevant articles below. I hope you will support software development network more in the future !
边栏推荐
猜你喜欢
Mobile measurement and depth link platform - Branch
【安全攻防】序列化與反序列,你了解多少?
注意力机制原理
About Confidence Intervals
VHDL implementation of arbitrary size matrix addition operation
Huawei and Xiaomi "copy each other"
CVPR 2022 best paper candidate | pip: six inertial sensors realize whole body dynamic capture and force estimation
PHP lightweight Movie Video Search Player source code
When QT uses qtooltip mouse to display text, the picture of the button will also be displayed and the prompt text style will be modified
Que savez - vous de la sérialisation et de l'anti - séquence?
随机推荐
25.(arcgis api for js篇)arcgis api for js线修改线编辑(SketchViewModel)
概率论公式
[dream database] add the task of automatically collecting statistical information
19.(arcgis api for js篇)arcgis api for js线采集(SketchViewModel)
1200.Minimum Absolute Difference
How to customize the shortcut key for latex to stop running
RestClould ETL 社区版六月精选问答
VHDL implementation of arbitrary size matrix addition operation
Vernacular high concurrency (2)
[dpdk] dpdk sample source code analysis III: dpdk-l3fwd_ 001
[Dameng database] after backup and recovery, two SQL statements should be executed
20. (ArcGIS API for JS) ArcGIS API for JS surface collection (sketchviewmodel)
ubuntu20安裝redisjson記錄
如何替换模型的骨干网络(backbone)
注意力机制原理
Probability formula
QT opens a file and uses QFileDialog to obtain the file name, content, etc
Delete data in SQL
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
pip只下载不安装