当前位置:网站首页>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.cnfThe 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:8ps:
-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 !
边栏推荐
- VHDL implementation of arbitrary size matrix multiplication
- 23. (ArcGIS API for JS) ArcGIS API for JS ellipse collection (sketchviewmodel)
- Restcloud ETL Community Edition June featured Q & A
- 机器学习笔记 - 使用机器学习进行鸟类物种分类
- Under the tide of "going from virtual to real", Baidu AI Cloud is born from real
- Sub pixel corner detection opencv cornersubpix
- Tencent cloud native database tdsql-c was selected into the cloud native product catalog of the Academy of communications and communications
- [leetcode] 700 and 701 (search and insert of binary search tree)
- 1200.Minimum Absolute Difference
- How to customize the shortcut key for latex to stop running
猜你喜欢

Function reentry, function overloading and function rewriting are understood by yourself

Probability formula

Significance and measures of source code confidentiality

Under the tide of "going from virtual to real", Baidu AI Cloud is born from real

About Confidence Intervals

HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother

Not All Points Are Equal Learning Highly Efficient Point-based Detectors for 3D LiDAR Point

Shangsilicon Valley JVM Chapter 1 class loading subsystem

Tencent cloud native database tdsql-c was selected into the cloud native product catalog of the Academy of communications and communications
![[leetcode] 450 and 98 (deletion and verification of binary search tree)](/img/89/dd7ac0d886e6bbca5a439386c576bb.jpg)
[leetcode] 450 and 98 (deletion and verification of binary search tree)
随机推荐
21. (article ArcGIS API for JS) ArcGIS API for JS rectangular acquisition (sketchviewmodel)
枚举通用接口&枚举使用规范
2022年上半年HIT行业TOP50
MySQL storage engine
未来发展路线确认!数字经济、数字化转型、数据...这次会议很重要
校招行测笔试-数量关系
Construction of Hisilicon universal platform: color space conversion YUV2RGB
First understand the principle of network
CMB's written test - quantitative relationship
代码质量管理
Shangsilicon Valley JVM Chapter 1 class loading subsystem
25. (ArcGIS API for JS) ArcGIS API for JS line modification line editing (sketchviewmodel)
qt-线程等01概念
Shell programming basics
About Confidence Intervals
Depth analysis of compilation constants, classloader classes, and system class loaders
API data interface of A-share index component data
【安全攻防】序列化與反序列,你了解多少?
[security attack and Defense] how much do you know about serialization and deserialization?
海思万能平台搭建:颜色空间转换YUV2RGB