当前位置:网站首页>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 \
边栏推荐
- Unit test concept and purpose
- NE555 waveform generator handle tutorial NE555 internal structure (I)
- 关于VCTK数据集
- Detailed analysis of operators i++ and ++i in JS, i++ and ++i
- Tibetan poem PTA
- Member management applet actual development 07 page Jump
- Share your own terminal DIY display banner
- Sword finger offer 19 Regular Expression Matching
- The real topic of the 11th provincial competition of Bluebridge cup 2020 - crop hybridization
- The longest selling mobile phone in China has been selling well since its launch, crushing iphone12
猜你喜欢

What if the disk of datanode is full?

双位置继电器ST2-2L/AC220V

High quality pump SolidWorks model material recommended, not to be missed

SAP ui5 beginner tutorial 19 - SAP ui5 data types and complex data binding

优质的水泵 SolidWorks模型素材推荐,不容错过

Oracle table creation and management

解决IDEA:Class ‘XXX‘ not found in module ‘XXX‘

New content violation degree determination scana bad information monitoring capability update issue 5

Member management applet actual development 07 page Jump

二十多年来第一次!CVPR最佳学生论文授予中国高校学生!
随机推荐
【2023联发科提前批笔试题】~ 题目及参考答案
Cmu15445 (fall 2019) project 1 - buffer pool details
P4 learning - Basic tunneling
二十多年来第一次!CVPR最佳学生论文授予中国高校学生!
Oracle临时表详解
Get to know the drawing component of flutter - custompaint
Host FL Studio fruit music production daw20.9
Ranger plug-in development (Part 2)
Multi graph explanation of resource preemption in yarn capacity scheduling
ArrayList analysis 1-cycle, capacity expansion, version
What is product thinking
How to do the performance pressure test of "Health Code"
Shift operators
[LeetCode] 两数之和【1】
解决 error MSB8031: Building an MFC project for a non-Unicode character set is deprecated.
Two-stage RO: part 1
Can JDBC based on openjdk connect to MySQL?
【学习笔记】构造
关于Unity一般的输入操作方式
写给 5000 粉丝的一封信!