当前位置:网站首页>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
边栏推荐
- _ FindText error
- Go语言JSON包使用
- ES6 face test questions (reference documents)
- ArcGIS table to excel exceeds the upper limit, conversion failed
- xlsxwriter. exceptions. Filecreateerror: [errno 13] permission denied
- On the problem of V-IF display and hiding
- Tell the truth of TS
- Format problems encountered in word typesetting
- ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
- Remember using Ali Font Icon Library for the first time
猜你喜欢

String function in MySQL

Re expression régulière

Go语言JSON包使用

Implementation of k8s redis one master multi slave dynamic capacity expansion

2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination

Element calculation distance and event object

Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战

QTableWidget使用讲解

Nat commun | current progress and open challenges of applied deep learning in Bioscience

Gets the time range of the current week
随机推荐
Compilation principle first set follow set select set prediction analysis table to judge whether the symbol string conforms to the grammar definition (with source code!!!)
Remember using Ali Font Icon Library for the first time
2022年广东省安全员A证第三批(主要负责人)特种作业证考试题库及在线模拟考试
ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
The JS timestamp of wechat applet is converted to / 1000 seconds. After six hours and one day, this Friday option calculates the time
2022年茶艺师(初级)考试模拟100题及模拟考试
String function in MySQL
Scikit learn sklearn 0.18 official document Chinese version
列錶的使用-增删改查
20222 return to the workplace
Open source key component multi_ Button use, including test engineering
Secure credit
re正则表达式
Calculation of fishing net road density
MySQL_ 01_ Simple data retrieval
YOLOv4剪枝【附代码】
Use of list - addition, deletion, modification and query
Cross domain settings of Chrome browser -- including new and old versions
I/O多路复用及其相关详解
Oil monkey website address