当前位置:网站首页>Docker 部署 MySQL 8
Docker 部署 MySQL 8
2022-07-01 00:39:00 【linmengmeng_1314】
Docker 部署 MySQL 8
1. 拉取镜像
直接去 dockerhub 就行,找自己想要的镜像版本:https://hub.docker.com/_/mysql
拉取镜像:docker pull mysql:8
我这里打算直接用 8
,则使用上面的命令,如果选择别的tag
,直接替换即可。
2. 启动容器并挂载目录
docker run --restart always \
--name mysql8 \
-p 3307:3306 \
-p 33070:33060 \
-v /usr/soft/mysql-3307/mysql-files:/var/lib/mysql-files \
-v /usr/soft/mysql-3307/data:/var/lib/mysql \
-v /usr/soft/mysql-3307/conf.d:/etc/mysql/conf.d \
-v /usr/soft/mysql-3307/etc.mysql:/etc/mysql \
-e MYSQL_ROOT_PASSWORD= abc23456\
-d mysql:8 \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_general_ci \
--default_authentication_plugin=mysql_native_password
这里-e MYSQL_ROOT_PASSWORD
直接指定root密码:abc23456
异常
1. 未挂载目录 /var/lib/mysql-files
报错信息:
Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
在启动容器时,添加挂载目录:-v /usr/soft/mysql-3307/mysql-files:/var/lib/mysql-files
2. Navicat 连接报错:2059-Authentication plugin caching_sha2_password
cannot be load…
给容器配置参数:--default_authentication_plugin=mysql_native_password
在启动容器的命令最后,添加该参数。
改成这样之后,虽然可以正常启动了,但是看下日志,有个提醒:
2022-06-28T10:01:24.463764Z 0 [Warning] [MY-010101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.
2022-06-28T10:01:24.463859Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-06-28T10:01:24.463892Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 1
2022-06-28T10:01:24.465571Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2022-06-28T10:01:24.465595Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2022-06-28T10:01:24.473710Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
可以看到 提示不建议使用,这里可以改为:
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_general_ci \
边栏推荐
- P4学习——p4runtime
- 冲击继电器ZC-23/DC220V
- History of deep learning
- [LeetCode] 爬楼梯【70】
- K210门禁毕设
- Experiment 8 T-SQL, stored procedure
- Fluent JSON serialization deserialization
- 【学习笔记】构造
- Tcp/ip protocol stack, about TCP_ RST | TCP_ ACK correct attitude
- New content violation degree determination scana bad information monitoring capability update issue 5
猜你喜欢
Pytorch auto derivation
PyTorch安装并使用gpu加速
Authentication principle of Ranger plug-in
Multi graph explanation of resource preemption in yarn capacity scheduling
C#生成putty格式的ppk文件(支持passphrase)
DX-11Q信号继电器
解决IDEA:Class ‘XXX‘ not found in module ‘XXX‘
C # generates PPK files in putty format (supports passphrase)
C language file operation for conquering C language
二十多年来第一次!CVPR最佳学生论文授予中国高校学生!
随机推荐
Using C language to realize the exchange between the contents of two arrays (provided that the array is the same size)
双位置继电器ST2-2L/AC220V
Metauniverse and virtual reality (II)
【学习笔记】简单dp
二十多年来第一次!CVPR最佳学生论文授予中国高校学生!
The question of IBL precomputation is finally solved
Length of the longest integrable subarray
技术人进阶画业务大图,手把手教学来了
Oracle-表的创建与管理
K210工地安全帽
P4学习——p4runtime
CMU15445 (Fall 2019) 之 Project#1 - Buffer Pool 详解
Is the public read-only field with immutable structure valid- Does using public readonly fields for immutable structs work?
Sword finger offer 18 Delete the node of the linked list
【日常记录】——对BigDecimal除法运算时遇到的Bug
获取屏幕高度
From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years
Ranger plug-in development (Part 2)
Authentication principle of Ranger plug-in
Share your own terminal DIY display banner