当前位置:网站首页>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 连接
边栏推荐
- inux摄像头(mipi接口)简要说明
- Rehabilitation type force deduction brush question notes D1
- 【软件测试】05 -- 软件测试的原则
- Database mysql all
- Integer to 8-bit binary explanation (including positive and negative numbers) scope of application -127~+127
- NVM Downloading npm version 6.7.0... Error
- 解读最早的草图-图像翻译工作SketchyGAN
- 1. Create Oracle database manually
- PR automatically moves forward after deleting clips
- SD_CMD_RECEIVE_SHIFT_REGISTER
猜你喜欢
Ros2 - workspace (V)
程序中的负数存储及类型转换
ROS2——ROS2对比ROS1(二)
Dameng database all
Mutual transformation between two-dimensional array and sparse array (sparse matrix)
Pycahrm reports an error: indentation error: unindent does not match any outer indentation
SRE核心体系了解
UTC, GPS time and Tai
Vant Weapp SwipeCell設置多個按鈕
cgroup_ memcg
随机推荐
testing framework
Using handler in a new thread
Marvell 88E1515 PHY loopback模式测试
Ros2 - Service Service (IX)
逻辑结构与物理结构
Xavier CPU & GPU high load power consumption test
Volcano resource reservation feature
Positive height system
Redis-01. First meet redis
mysql设置触发器问题
Skywalking all
Use ffmpeg to rotate, flip up and down, and flip horizontally
Edge calculation data sorting
Matlab在线性代数中的应用(四):相似矩阵及二次型
Ros2 topic (VIII)
[tf] Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initial
Initialization of global and static variables
GDB code debugging
UTC, GPS time and Tai
Instruction execution time