当前位置:网站首页>Docker installs MySQL and uses Navicat to connect
Docker installs MySQL and uses Navicat to connect
2022-07-05 06:59:00 【Silence, your name】
Create a mapping directory , I installed it in the user directory
mkdir ~/mysql
mkdir ~/mysql/conf
mkdir ~/mysql/logs
mkdir ~/mysql/data
Execute the above commands respectively , Create file directory

# start-up docker run -id \ -p 3306:3306 \ --name=mysql \ -v $PWD/conf:/etc/mysql/conf.d \ -v $PWD/logs:/logs \ -v $PWD/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=123456 \ -d mysql \ --character-set-server=utf8mb4 \ --collation-server=utf8mb4_general_ci
# explain
docker run Create a new container , Run this container at the same time -p 3306:3306 Set port mapping Exposed ports : Container port --name The name of the container after startup -v Volume mount Out of container Directory : In-container directory –restart unless-stopped Container restart strategy -e MYSQL_ROOT_PASSWORD=root Set up root User's password , After the container is started, it is used for login mysql \ shell Command line break $PWD Current user directory
Due to the use of $PWD So you need to get into mysql Catalog cd ~/mysql And then execute docker command

Look at the container Whether the startup is successful docker ps

Into the container docker exec -it mysql bash

Sign in msyql mysql -uroot -p123456

Create user
CREATE USER 'silence'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

Authorized user remote login
GRANT ALL PRIVILEGES ON *.* TO 'silence'@'%';

navicat Connect

边栏推荐
- Cloud native related technology learning
- Utf8 encoding
- 现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
- SOC_SD_DATA_FSM
- Build a microservice cluster environment locally and learn to deploy automatically
- Use the Paping tool to detect TCP port connectivity
- Logical structure and physical structure
- postmessage通信
- . Net core stepping on the pit practice
- Sum of two numbers, the numbers in the array are converted to decimal, added, and output inversely
猜你喜欢

Skywalking all

你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?

达梦数据库全部
![[algorithm post interview] interview questions of a small factory](/img/62/6e330b1eba38f2dc67b21a10f0e2a8.jpg)
[algorithm post interview] interview questions of a small factory

.net core踩坑实践

Volcano resource reservation feature

7. Oracle table structure

Orin installs CUDA environment

ethtool 原理介绍和解决网卡丢包排查思路(附ethtool源码下载)

Build a microservice cluster environment locally and learn to deploy automatically
随机推荐
IPage能正常显示数据,但是total一直等于0
6-2 sequence table operation set
【软件测试】04 -- 软件测试与软件开发
LSA Type Explanation - detailed explanation of lsa-2 (type II LSA network LSA) and lsa-3 (type III LSA network Summary LSA)
并发编程 — 如何中断/停止一个运行中的线程?
Volcano resource reservation feature
现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
[tf] Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initial
PHY驱动调试之 --- PHY控制器驱动(二)
Positive height system
SRE核心体系了解
Vant weapp swippecell set multiple buttons
[Chongqing Guangdong education] 1185t administrative leadership reference test of National Open University in autumn 2018
Sre core system understanding
Mid 2022 documentary -- the experience of an ordinary person
乐鑫面试流程
【obs】x264编码:“buffer_size“
C语言数组专题训练
postmessage通信
[algorithm post interview] interview questions of a small factory