docker 下安装mysql8.0

在docker中查询mysql镜像

bash 复制代码
PS C:\Users\admin> docker search mysql
NAME                            DESCRIPTION                                      STARS     OFFICIAL   AUTOMATED
mysql                           MySQL is a widely used, open-source relation...   14568     [OK]
mariadb                         MariaDB Server is a high performing open sou...   5559      [OK]
percona                         Percona Server is a fork of the MySQL relati...   620       [OK]
phpmyadmin                      phpMyAdmin - A web interface for MySQL and M...   886       [OK]
bitnami/mysql                   Bitnami MySQL Docker Image                       100                  [OK]
circleci/mysql                  MySQL is a widely used, open-source relation...   29
bitnami/mysqld-exporter                                                          5
ubuntu/mysql                    MySQL open source fast, stable, multi-thread...   53
cimg/mysql                                                                       2
rapidfort/mysql                 RapidFort optimized, hardened image for MySQL    25
rapidfort/mysql8-ib             RapidFort optimized, hardened image for MySQ...   9
google/mysql                    MySQL server for Google Compute Engine           25                   [OK]
rapidfort/mysql-official        RapidFort optimized, hardened image for MySQ...   9
hashicorp/mysql-portworx-demo                                                    0
elestio/mysql                   Mysql, verified and packaged by Elestio          0
newrelic/mysql-plugin           New Relic Plugin for monitoring MySQL databa...   1                    [OK]
bitnamicharts/mysql                                                              0
databack/mysql-backup           Back up mysql databases to... anywhere!          101
linuxserver/mysql               A Mysql container, brought to you by LinuxSe...   41
mirantis/mysql                                                                   0
docksal/mysql                   MySQL service images for Docksal - https://d...   0
linuxserver/mysql-workbench                                                      52
vitess/mysqlctld                vitess/mysqlctld                                 1                    [OK]
eclipse/mysql                   Mysql 5.7, curl, rsync                           1                    [OK]
drupalci/mysql-5.5              https://www.drupal.org/project/drupalci          3                    [OK]
PS C:\Users\admin> docker search mysql:8
NAME                                   DESCRIPTION                                      STARS     OFFICIAL   AUTOMATED
lkhoho/mysql                           Thin wrapper of official mysql:8.0 image.        0
benoit93260/mysql-server8.0.19         server mysql:8.0.19 CentOs7 mysql-shell:8.0....   0
bolinz/mysql                           mysql:8.0.26                                     0
k2jeans/mysql                          mysql:8.0.32 VOLUME ~/data/mysql:/var/lib/my...   0
phunkytube/mysql                       Like mysql:8.0.19 but turns OFF skip-name-re...   0
kamatimaru/mysql80-ja                  Added Japanese support settings to mysql:8.0...   0
felodel/killbillmysql                  mysql:8  killbilldb - killbill 0.20 version      0
c3p16l12/mysql                         Built with mysql:8.0.13.                         0
lahouely/mysql8_utf8_native_password   A custom mysql image based on mysql:8.0 with...   0
bogdan1980b/mysql                      mysql:8.0.19 with a default DB named database    0
strongxyz/mysql                        gcr.io/ml-pipeline/mysql:8.0.26                  0
jaykangta/maze-mysql                   based on mysql:8.0                               0
horiasuciu/mysql                       mysql:8.0 - Version used by WorldPress Appli...   0
candresortizm1/mysql-getting-started   Image based on mysql:8.0 official image          0
flandycheng/gaoqi_mysql8                docker run --name gaoqi-mysql -e MYSQL_ROOT...   0
jagenwen/mysql                         docker run -d -it -p 3306:3306 --name mysql ...   0
kuntianhao/mysql                       mysql:8                                          0
vkvich/zabbix-mysql                    mysql:8.0                                        0
dockerbsm/phpmyadmin-mysql             phpmyadmin/phpmyadmin:5.1.1 & mysql:8.0.27       0

下载镜像:

bash 复制代码
PS C:\Users\admin> docker pull mysql:8.0
8.0: Pulling from library/mysql
8e0176adc18c: Pull complete
a6b6bf6e5d0f: Pull complete
c17b83f8620f: Pull complete
b2e259cd9b6c: Pull complete
366131ab00d1: Pull complete
2f99ba83a3cb: Pull complete
f7c88955f01f: Pull complete
577fb415d7f8: Pull complete
29160ed46eb1: Pull complete
69ce9884ce5d: Pull complete
848f0dceb14c: Pull complete
Digest: sha256:974cac08fff819ea2dfeb83fed4d2eb5100bb79603aff6148bdc53d8be4895f3
Status: Downloaded newer image for mysql:8.0
docker.io/library/mysql:8.0

What's Next?
  View summary of image vulnerabilities and recommendations → docker scout quickview mysql:8.0

查询现有镜像:

bash 复制代码
PS C:\Users\admin> docker image ls
REPOSITORY                TAG       IMAGE ID       CREATED        SIZE
mysql                     8.0       96bc8cf3633b   8 days ago     582MB
redis                     latest    7c4b517da47d   8 weeks ago    153MB
mysql                     5.7       a5b7ceed4074   3 months ago   581MB
elasticsearch             6.8.3     1d0fd79266e6   4 years ago    800MB
mobz/elasticsearch-head   5         b19a5c98e43b   6 years ago    824MB

启动mysql镜像:

bash 复制代码
PS C:\Users\admin> docker run -p 3306:3306 --name mysql_v8_0 -e MYSQL_ROOT_PASSWORD=root -d mysql:8.0  --lower_case_table_names=1
3d0344fd7cd7bfca6be99b3b67c5a6f46501ef3165ab7cb6671c28324c4c05a4

在docker-desktop查看启动结果:

为何要安装mysql8.0,不能直接使用原来的mysql5.7,因为

在 mysql 数据库中导入sql文件时,出现的 error 信息,

Unknown collation: 'utf8mb4_0900_ai_ci'

在MySQL5.6,MySQL5.7中选择字符集为 utf8mb4 时,默认的排序规则是 utf8mb4_general_ci ,而且可选择的排序规则中没有 utf8mb4_0900_ai_ci

【问题解决】MYSQL数据库导入错误-utf8mb4_0900_ai_ci_mysql utf8mb4_0900_ai_ci-CSDN博客

docker安装mysql 8.0.20 版本 超详细教程_dockers 安装mysql8-CSDN博客

在navicat查询MySQL版本号:

bash 复制代码
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.35    |
+-----------+
1 row in set (0.02 sec)

【精选】写最好的Docker安装最新版MySQL8(mysql-8.0.31)教程(参考Docker Hub和MySQL官方文档)_docker mysql8_大白有点菜的博客-CSDN博客

很想上docker官网**https://hub.docker.com/**

如果能上去可以看看下面的内容:

1、在Docker Hub中搜索关键字"mysql",查看MySQL的最新稳定版,包含MySQL8和MySQL5.7系列。对应的MySQL页面有教程,读者也可自行去看,但是不是很完整,笔者的教程参考官网且有改动。

(1)Docker Hub中搜索"mysql"。

(2)选择官方的"mysql"。页面是MySQL在Docker中的版本的相关介绍,这里有这么一个规律:8.0.31, 8.0, 8, latest, 8.0.31-oracle, 8.0-oracle, 8-oracle, oracle 其实都是同一个版本,它们的镜像ID都是相同,在页面中放在同一行展示的,都是同一个版本,笔者验证过。页面同时也有操作教程,并不是很全,只给出核心操作步骤。

Docker Hub中MySQL介绍:https://hub.docker.com/_/mysql

docker仓库mysql所有版本_Docker 安装 MySQL8.0_吴人奔越的博客-CSDN博客

npm 超详细教程 - 知乎 (zhihu.com)

相关推荐
xiaok34 分钟前
docker desktop拉取镜像失败
docker
Aisaka_Taiga1 小时前
Docker拉取官方镜像源
docker
夏天的味道٥1 小时前
MySQL explain命令的作用
android·mysql·adb
玄辰星君2 小时前
【在 macOS 系统上使用 Docker 启动 Kafka 的完整指南】
macos·docker·kafka
mCell10 小时前
Docker 进阶教程
运维·docker·容器
mCell10 小时前
Docker 入门教程
运维·docker·操作系统
深耕云原生12 小时前
Kubernetes 深入浅出系列 | 容器剖析之容器安全
安全·容器·kubernetes
2301_7736386317 小时前
Kubernetes部署MySQL主从复制
mysql·容器·kubernetes
kong@react21 小时前
docker部署spring boot,安装jdk17、maven3.8.8详细步骤
java·spring boot·docker
hhzz1 天前
Kubernetes 的20 个核心命令分类详解
云原生·容器·kubernetes