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

边栏推荐
- Orin two brushing methods
- Special training of C language array
- mingling
- Time is fast, please do more meaningful things
- The “mode“ argument must be integer. Received an instance of Object
- new和malloc的区别
- 现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
- ROS2——Service服务(九)
- 逻辑结构与物理结构
- Integer to 8-bit binary explanation (including positive and negative numbers) scope of application -127~+127
猜你喜欢

Use ffmpeg to rotate, flip up and down, and flip horizontally

The problem of Chinese garbled code in the vscode output box can be solved once for life

Marvell 88e1515 PHY loopback mode test

SolidWorks template and design library are convenient for designers to call

namespace

Ros2 topic (VIII)

UTC, GPS time and Tai

The “mode“ argument must be integer. Received an instance of Object

Volcano 资源预留特性

ROS2——ROS2对比ROS1(二)
随机推荐
2. Addition and management of Oracle data files
【软件测试】05 -- 软件测试的原则
npm install -g/--save/--save-dev的区别
vim
SRE核心体系了解
Xiaomi written test real question 1
new和malloc的区别
6-3 find the table length of the linked table
Rehabilitation type force deduction brush question notes D1
逻辑结构与物理结构
现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
How to answer when you encounter a jet on CSDN?
乐鑫面试流程
Marvell 88e1515 PHY loopback mode test
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
ROS2——常用命令行(四)
Ros2 - first acquaintance with ros2 (I)
Mutual transformation between two-dimensional array and sparse array (sparse matrix)
inux摄像头(mipi接口)简要说明
Redis-02. Redis command