当前位置:网站首页>Docker installation MySQL simple without pit
Docker installation MySQL simple without pit
2022-06-24 23:00:00 【Bald and weak.】
List of articles
1. Switch root user
2. Download the image file
docker pull mysql:5.7
3. Create an instance and start
docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7
A long string of id It indicates that the mysql Successful launch
【 Port mapping and file mounting 】
Parameter description
-p 3306:3306: The container of 3306 Port mapping to host's 3306 port
-name: Container name
-v /mydata/mysql/conf:/etc/mysql: Mount the configuration folder to the host
-v /mydata/mysql/log:/var/log/mysql: Mount the log folder to the host
-v /mydata/mysql/data:/var/lib/mysql/: Mount the configuration folder to the host
-e MYSQL_ROOT_PASSWORD=root: initialization root User's password
-d It's backstage
Every docker It's all one linux System , So when starting the container, you need to set docker Is mapped to linux Host port
-v: take linux Local files and docker Specified file binding for , Modifying local files will synchronize docker file , It is much more convenient to modify the configuration
4.MySQL To configure
Due to the use -v /mydata/mysql/conf:/etc/mysql, Will local conf Directory and docker Configuration directory binding , It just needs to be modified linux Local configuration is enough .
vi /mydata/mysql/conf/my.cnf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
docker restart mysql restart mysql
5. Tips : solve MySQL The problem of slow connection
Add the following... In the configuration file , And restart mysql
[mysqld]
skip-name-resolve
explain : skip-name-resolve: Skip domain name resolution
6. container-passing mysql Command line tool connection
docker exec -it mysql mysql -uroot -proot
7. Set up remote access
grant all privileges on . to ‘root’@‘%’ identified by ‘root’ with grant option; flush privileges;
8. use navicat Connect and have a look
Default root User password is root
边栏推荐
- 是否需要提高代码阅读能力?这有技巧
- AttacKG: Constructing Technique Knowledge Graph from Cyber Threat Intelligence Reports代码复现
- 23研考生注意啦!备考期间最容易中招的骗局,居然是它们?!
- O (n) complexity hand tear sorting interview questions | an article will help you understand counting sorting
- Research Report on terahertz imaging system industry - market status analysis and development prospect forecast
- vulnhub Vegeta: 1
- [Wuhan University] information sharing of the first and second postgraduate entrance examinations
- Research Report on market evaluation and investment direction of Chinese dermatology drugs (2022 Edition)
- 结合源码剖析Oauth2分布式认证与授权的实现流程
- Leetcode: calculate the number of elements less than the current element on the right (sortedlist+bisect\u left)
猜你喜欢

Learning bit segment (1)

环境配置 | VS2017配置OpenMesh源码和环境
![[laravel series 7.9] test](/img/49/4b470a8b309bab4a83eed930dcce65.png)
[laravel series 7.9] test

糖豆人登录报错解决方案

Heavyweight! Fada is listed as a "specialized and new" enterprise

Solution to the login error of tangdou people

Database transaction Transanction

京东618会议平板排行榜公布,新锐黑马品牌会参谋角逐前三名,向国货老大华为学习

2022-06-16 工作记录--JS-判断字符串型数字有几位 + 判断数值型数字有几位 + 限制文本长度(最多展示n个字,超出...)

Beijiafu (p+f) R2000 modified radar IP
随机推荐
See how sparksql supports enterprise level data warehouse
Research Report on market supply and demand and strategy of ceiling power supply device industry in China
Layer 2 and layer 3 forwarding principle based on VLAN
Principle of IP routing
研究生宿舍大盘点!令人羡慕的研究生宿舍来了!
C language operators and expressions
Servlet
It's hard to hear C language? Why don't you take a look at my article (7) input and output
Programmers become gods by digging holes in one year, carrying flags in five years and becoming gods in ten years
New, Huawei cloud Kaitian apaas
2022安全员-B证考试题库及答案
【nvm】
[WSL] SSH Remote Connection and host port forwarding configuration
EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段
EPICS記錄參考3 -- 所有記錄都有的字段
Fanuc robot_ Introduction to Karel programming (1)
2022-06-16 工作记录--JS-判断字符串型数字有几位 + 判断数值型数字有几位 + 限制文本长度(最多展示n个字,超出...)
花房集团二次IPO:成于花椒,困于花椒
Problem solving - nested lists
[untitled]