当前位置:网站首页>docker安装mysql并使用navicat连接
docker安装mysql并使用navicat连接
2022-07-05 06:57:00 【Silence丶你的名字】
创建映射目录,我安装在用户目录下
mkdir ~/mysql
mkdir ~/mysql/conf
mkdir ~/mysql/logs
mkdir ~/mysql/data
分别执行以上命令,创建文件目录
#启动 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
# 说明
docker run 创建一个新的容器 , 同时运行这个容器 -p 3306:3306 设置端口映射 对外暴露的端口:容器端口 --name 容器启动后的名称 -v 卷挂载 容器外目录:容器内目录 –restart unless-stopped 容器重启策略 -e MYSQL_ROOT_PASSWORD=root 设置root用户的密码,容器启动后用于登录mysql \ shell 命令换行符 $PWD 当前用户目录
由于使用了$PWD 所以需要进入到mysql目录 cd ~/mysql 然后执行docker命令
查看容器 启动是否成功 docker ps
进入容器 docker exec -it mysql bash
登录msyql mysql -uroot -p123456
创建用户
CREATE USER 'silence'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
授权用户远程登录
GRANT ALL PRIVILEGES ON *.* TO 'silence'@'%';
navicat 连接
边栏推荐
- Marvell 88E1515 PHY loopback模式测试
- Orin installs CUDA environment
- 【软件测试】04 -- 软件测试与软件开发
- Xavier CPU & GPU high load power consumption test
- ROS2——安装ROS2(三)
- Orin 两种刷机方式
- Use the Paping tool to detect TCP port connectivity
- Use ffmpeg to rotate, flip up and down, and flip horizontally
- 6-3 find the table length of the linked table
- UTC, GPS time and Tai
猜你喜欢
Some classic recursion problems
Build a microservice cluster environment locally and learn to deploy automatically
Use ffmpeg to rotate, flip up and down, and flip horizontally
SOC_SD_CMD_FSM
Adg5412fbruz-rl7 applies dual power analog switch and multiplexer IC
Instruction execution time
Positive height system
how to understand the “model independent.“
Skywalking all
Ros2 - node (VII)
随机推荐
代码中的英语全部
1290_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
ROS2——topic话题(八)
Ros2 - node (VII)
ROS2——ROS2对比ROS1(二)
【软件测试】04 -- 软件测试与软件开发
【软件测试】06 -- 软件测试的基本流程
2. Addition and management of Oracle data files
All English in the code
Technical conference arrangement
Initialization of global and static variables
Ros2 topic (VIII)
Technology blog learning website
在本地搭建一个微服务集群环境,学习自动化部署
Architecture
mingling
Ros2 - first acquaintance with ros2 (I)
Edge calculation data sorting
基于FPGA的一维卷积神经网络CNN的实现(八)激活层实现
【软件测试】02 -- 软件缺陷管理