当前位置:网站首页>Docker 安装 MySQL
Docker 安装 MySQL
2022-04-23 18:00:00 【浅唱~幸福】
1.查看可用的 MySQL 版本 访问 MySQL 镜像库地址:https://hub.docker.com/_/mysql?tab=tags 。 可以通过 Sort by 查看其他版本的 MySQL,默认是最新版本 mysql:latest
2.我们还可以用 docker search mysql 命令来查看可用版本
3.拉取 MySQL 镜像 这里我拉取是5.7的 命令:docker pull mysql:5.7
4.查看是否已安装了 mysql:
docker images
5.以下命令来运行 mysql 容器:
docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
参数说明:
- -p 3306:3306 :映射容器服务的 3306 端口到宿主机的 3306 端口,外部主机可以直接通过 宿主机ip:3306 访问到 MySQL 的服务。
- MYSQL_ROOT_PASSWORD=123456:设置 MySQL 服务 root 用户的密码。
6.用docker ps 命令查看是否运行:
7. 进入容器 命令:docker exec -it ae2026c8ee58 bash
8.登录mysql
mysql -u root -p
9.授权
授权命令:GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY "123456";
刷新命令:flush privileges;
退出:exit
10 Navicat连接:
版权声明
本文为[浅唱~幸福]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_39643007/article/details/111587856
边栏推荐
- Leak detection and vacancy filling (VII)
- Using files to save data (C language)
- C#字节数组(byte[])和字符串相互转换
- cartographer_ There is no problem compiling node, but running the bug that hangs directly
- Svn simple operation command
- 2022制冷与空调设备运行操作判断题及答案
- ArcGIS table to excel exceeds the upper limit, conversion failed
- Classes and objects
- 2022江西光伏展,中国分布式光伏展会,南昌太阳能利用展
- Element calculation distance and event object
猜你喜欢
[UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)
Re expression régulière
Chrome浏览器的跨域设置----包含新老版本两种设置
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
Process management command
Data stream encryption and decryption of C
Fashion classification case based on keras
k8s之实现redis一主多从动态扩缩容
Laser slam theory and practice of dark blue College Chapter 3 laser radar distortion removal exercise
C# 网络相关操作
随机推荐
2022 Jiangxi Photovoltaic Exhibition, China Distributed Photovoltaic Exhibition, Nanchang Solar Energy Utilization Exhibition
2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination
journal
Clion installation tutorial
2022年广东省安全员A证第三批(主要负责人)特种作业证考试题库及在线模拟考试
vite配置proxy代理解决跨域
Cloud native Virtualization: building edge computing instances based on kubevirt
C# 的数据流加密与解密
cartographer_ There is no problem compiling node, but running the bug that hangs directly
Leak detection and vacancy filling (VIII)
C#字节数组(byte[])和字符串相互转换
Tensorflow tensor introduction
2022江西光伏展,中国分布式光伏展会,南昌太阳能利用展
JS high frequency interview questions
C language input and output (printf and scanf functions, putchar and getchar functions)
[appium] write scripts by designing Keyword Driven files
Tell the truth of TS
C1 notes [task training part 2]
列錶的使用-增删改查
Calculation of fishing net road density