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

边栏推荐
- Executealways of unity is replacing executeineditmode
- Initialization of global and static variables
- [Chongqing Guangdong education] National Open University 2018 autumn 0702-22t contemporary Chinese political system reference questions
- 2. Addition and management of Oracle data files
- LSA Type Explanation - lsa-1 [type 1 LSA - router LSA] detailed explanation
- 逻辑结构与物理结构
- Ret2xx---- common CTF template proposition in PWN
- GDB code debugging
- vim
- 在本地搭建一个微服务集群环境,学习自动化部署
猜你喜欢

Ret2xx---- common CTF template proposition in PWN

代码中的英语全部

ROS2——topic话题(八)

Sre core system understanding

postmessage通信

Dameng database all

UTC, GPS time and Tai

Vant weapp swippecell set multiple buttons

Configuration method and configuration file of SolidWorks GB profile library

Adg5412fbruz-rl7 applies dual power analog switch and multiplexer IC
随机推荐
逻辑结构与物理结构
Integer to 8-bit binary explanation (including positive and negative numbers) scope of application -127~+127
vim
Interpretation of the earliest sketches - image translation work sketchygan
.net core踩坑实践
Initialization of global and static variables
Ros2 - Service Service (IX)
Architecture
ROS2——topic话题(八)
Vscode configures the typera editor for MD
cgroup_ memcg
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
三体目标管理笔记
Use ffmpeg to rotate, flip up and down, and flip horizontally
Database mysql all
数据库Mysql全部
Technical conference arrangement
Written examination notes
Unity UGUI不同的UI面板或者UI之间如何进行坐标匹配和变换
*P++, (*p) + +, * (p++) differences