当前位置:网站首页>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
边栏推荐
- 现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
- Rehabilitation type force deduction brush question notes D3
- Spinningup drawing curve
- PHY驱动调试之 --- MDIO/MDC接口22号和45号条款(一)
- 【软件测试】05 -- 软件测试的原则
- 2. Addition and management of Oracle data files
- 二分查找(折半查找)
- .net core踩坑实践
- Volcano resource reservation feature
- Mutual transformation between two-dimensional array and sparse array (sparse matrix)
猜你喜欢
随机推荐
【软件测试】02 -- 软件缺陷管理
LSA Type Explanation - lsa-1 [type 1 LSA - router LSA] detailed explanation
程序中的负数存储及类型转换
mingling
Configuration method and configuration file of SolidWorks GB profile library
小米笔试真题一
Sum of two numbers, the numbers in the array are converted to decimal, added, and output inversely
睿智的目标检测59——Pytorch Focal loss详解与在YoloV4当中的实现
Ros2 - ros2 vs. ros1 (II)
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
What is linting
Orin installs CUDA environment
Get class files and attributes by reflection
【MySQL8.0不支持表名大写-对应方案】
How to correctly ask questions in CSDN Q & A
About vscode, "code unreachable" will be displayed when calling sendline series functions with pwntools“
基于FPGA的一维卷积神经网络CNN的实现(八)激活层实现
.net core踩坑实践
Empire help
Application of recyclerview