Docker安装Mysql

2022-07-06  本文已影响0人  老羊_肖恩

使用Docker安装Mysql非常简单,一共就两步,首先我们去docker hub官网搜索查看可用的Mysql镜像版本。

   第一步:拉取指定版本的mysql镜像:

docker pull mysql:8.0.29

  第二步:启动指定版本的mysql镜像。

docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=xxxxxx -d mysql:8.0.29

然后我们进入容器,使用命令连接mysql:

mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit;
Bye

连接Mysql成功,至此,使用Docker安装Mysql成功。详细过程和细节配置可以参考Docker官方文档https://hub.docker.com/_/mysql

上一篇 下一篇

猜你喜欢

热点阅读