当前位置:网站首页>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 !
边栏推荐
- Search of linear table
- VHDL implementation of arbitrary size matrix multiplication
- Free PHP online decryption tool source code v1.2
- Shangsilicon Valley JVM Chapter 1 class loading subsystem
- Do you know the five most prominent advantages of E-bidding?
- VHDL implementation of single cycle CPU design
- 树莓派设置wifi自动连接
- QT item table new column name setting requirement exercise (find the number and maximum value of the array disappear)
- QT 项目 表格新建列名称设置 需求练习(找数组消失的数字、最大值)
- 预处理——插值
猜你喜欢
My brave way to line -- elaborate on what happens when the browser enters the URL
Open3D 网格滤波
Create applet from 0
代码质量管理
Tencent cloud native database tdsql-c was selected into the cloud native product catalog of the Academy of communications and communications
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
24. (ArcGIS API for JS) ArcGIS API for JS point modification point editing (sketchviewmodel)
Open3d mesh filtering
浅谈网络安全之文件上传
Free PHP online decryption tool source code v1.2
随机推荐
代码质量管理
Que savez - vous de la sérialisation et de l'anti - séquence?
21. (article ArcGIS API for JS) ArcGIS API for JS rectangular acquisition (sketchviewmodel)
SSL certificate deployment
腾讯云原生数据库TDSQL-C入选信通院《云原生产品目录》
Leetcode-02 (linked list question)
23. (ArcGIS API for JS) ArcGIS API for JS ellipse collection (sketchviewmodel)
Shangsilicon Valley JVM Chapter 1 class loading subsystem
海思万能平台搭建:颜色空间转换YUV2RGB
The latest 2022 review of "small sample deep learning image recognition"
Code quality management
我的勇敢对线之路--详细阐述,浏览器输入URL发生了什么
2022.6.28
机器学习笔记 - 使用机器学习进行鸟类物种分类
About Tolerance Intervals
About Confidence Intervals
自适应非欧表征广告检索系统AMCAD
How to replace the backbone of the model
Delete data in SQL
Variables, process control and cursors (MySQL)