当前位置:网站首页>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

边栏推荐
猜你喜欢

PHY驱动调试之 --- MDIO/MDC接口22号和45号条款(一)

Orin two brushing methods

ROS2——功能包(六)

MySQL (UDF authorization)

NVM Downloading npm version 6.7.0... Error

Record of problems in ollvm compilation

GDB code debugging

Vant weapp swippecell set multiple buttons

Literacy Ethernet MII interface types Daquan MII, RMII, smii, gmii, rgmii, sgmii, XGMII, XAUI, rxaui

The problem of Chinese garbled code in the vscode output box can be solved once for life
随机推荐
Orin two brushing methods
Cookie、Session、JWT、token四者间的区别与联系
SOC_SD_CMD_FSM
Rehabilitation type force deduction brush question notes D1
NVM Downloading npm version 6.7.0... Error
Executealways of unity is replacing executeineditmode
Ret2xx---- common CTF template proposition in PWN
Technical conference arrangement
Initialization of global and static variables
Marvell 88E1515 PHY loopback模式测试
Pycahrm reports an error: indentation error: unindent does not match any outer indentation
Ros2 - ros2 vs. ros1 (II)
【obs】x264编码:“buffer_size“
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
Integer to 8-bit binary explanation (including positive and negative numbers) scope of application -127~+127
Some classic recursion problems
ethtool 原理介绍和解决网卡丢包排查思路(附ethtool源码下载)
使用paping工具进行tcp端口连通性检测
.net core踩坑实践
SRE核心体系了解