当前位置:网站首页>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
边栏推荐
- Re expression régulière
- Build openstack platform
- Anchor location - how to set the distance between the anchor and the top of the page. The anchor is located and offset from the top
- 2022年上海市安全员C证操作证考试题库及模拟考试
- 消费者灰度实现思路
- [UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)
- In JS, t, = > Analysis of
- I/O多路复用及其相关详解
- [UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
- Tell the truth of TS
猜你喜欢
Examination question bank and online simulation examination of the third batch (main person in charge) of special operation certificate of safety officer a certificate in Guangdong Province in 2022
C network related operations
2022 tea artist (primary) examination simulated 100 questions and simulated examination
Using files to save data (C language)
C1小笔记【任务训练篇二】
2022年上海市安全员C证操作证考试题库及模拟考试
GDAL + ogr learning
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
Open source key component multi_ Button use, including test engineering
Data stream encryption and decryption of C
随机推荐
Remember using Ali Font Icon Library for the first time
Halo 开源项目学习(二):实体类与数据表
Listen for click events other than an element
positioner
2022 judgment questions and answers for operation of refrigeration and air conditioning equipment
The ultimate experience, the audio and video technology behind the tiktok
Transfer learning of five categories of pictures based on VGg
Auto. JS custom dialog box
C#的随机数生成
cv_ Solution of mismatch between bridge and opencv
Selenium + phantom JS crack sliding verification 2
Identification verification code
Basic usage of crawler requests
Stanford machine learning course summary
An example of linear regression based on tensorflow
Halo open source project learning (II): entity classes and data tables
Map basemap Library
[appium] write scripts by designing Keyword Driven files
2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination
Re expression régulière