当前位置:网站首页>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
边栏推荐
- China solar window market trend report, technical dynamic innovation and market forecast
- [personal experiment report]
- It's hard to hear C language? Why don't you take a look at my article (7) input and output
- Fanuc robot_ Introduction to Karel programming (1)
- The usage difference between isempty and isblank is so different that so many people can't answer it
- Research Report on terahertz imaging system industry - market status analysis and development prospect forecast
- Learning bit segment (1)
- 2022安全员-B证考试题库及答案
- ThreadLocal memory leak
- How to integrate Huawei cloud function services in fluent
猜你喜欢

See how sparksql supports enterprise data warehouse

Parental delegation mechanism

详细了解关于sentinel的实际应用

EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段

JMM 最最最核心的概念:Happens-before 原则

2022 simulated 100 questions and simulated examination of high-altitude installation, maintenance and demolition

Annotation

High level application of SQL statements in MySQL database (I)

ACL (access control list) basic chapter - Super interesting learning network

关于某手滑块的一些更新(6-18,js逆向)
随机推荐
shopee开店入驻流水如何提交?
源码阅读 | OpenMesh读取文本格式stl的过程
Heavyweight! Fada is listed as a "specialized and new" enterprise
Attackg: constructing technical knowledge graph from cyber thread intelligence reports
【文本数据挖掘】中文命名实体识别:HMM模型+BiLSTM_CRF模型(Pytorch)【调研与实验分析】
LeetCode Algorithm 剑指 Offer 52. 两个链表的第一个公共节点
Layer 2 and layer 3 forwarding principle based on VLAN
EPICS记录参考2--EPICS过程数据库概念
How to integrate Huawei cloud function services in fluent
糖豆人登录报错解决方案
OSPF basic content
面试害怕被问MySQL相关问题 ?这份三万字精华总结 + 面试100 问,吊打面试官完全够了
23研考生注意啦!备考期间最容易中招的骗局,居然是它们?!
[laravel series 7.9] test
2022 safety officer-b certificate examination question bank and answers
O (n) complexity hand tear sorting interview questions | an article will help you understand counting sorting
Basic principles of layer 2 switching
Code farmers should also understand the IPv4 subnet division of point networks
vulnhub DC: 2
【ROS玩转Turtlesim小海龟】