当前位置: 首页 > news >正文

神奇的bug之docker compose启动mysql失败

说明

本人开发环境是
windows 11 + wsl + ubuntu 22.04 + docker desktop + idea + docker compose
启动mysql 的配置如下

  # Hive Metastore数据库服务hive-metastore-db:image: mysql:8.0container_name: hive-metastore-dbhostname: hive-metastore-dbnetworks:- hadoop-networkports:- "3306:3306"volumes:- hive-metastore-data:/var/lib/mysqlenvironment:- MYSQL_ROOT_PASSWORD=root- MYSQL_DATABASE=hive- MYSQL_USER=hive- MYSQL_PASSWORD=hivecommand: ['--character-set-server=utf8mb4','--collation-server=utf8mb4_unicode_ci','--default-storage-engine=InnoDB','--innodb-file-per-table=1']

其他的定义是正常的
包含

volumes:hive_metastore_data:hive-metastore-data:

但是当我使用 hive-metastore-data 就会报错,hive_metastore_data 是正常的
演示如下

在这里插入图片描述

2025-06-17 11:50:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.42-1.el9 started.
2025-06-17T11:50:08.307137374Z 2025-06-17 11:50:08+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2025-06-17T11:50:08.319708510Z 2025-06-17 11:50:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.42-1.el9 started.
2025-06-17T11:50:08.556133575Z '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2025-06-17T11:50:08.831452880Z 2025-06-17T11:50:08.826214Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2025-06-17T11:50:08.831491144Z 2025-06-17T11:50:08.828159Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.42) starting as process 1
2025-06-17T11:50:08.841343139Z 2025-06-17T11:50:08.840907Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-06-17T11:50:09.090728872Z 2025-06-17T11:50:09.090388Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-06-17T11:50:09.235934362Z mysqld: Table 'mysql.plugin' doesn't exist
2025-06-17T11:50:09.235984183Z 2025-06-17T11:50:09.235731Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2025-06-17T11:50:09.236567653Z 2025-06-17T11:50:09.236277Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.237261156Z 2025-06-17T11:50:09.236810Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.237451989Z 2025-06-17T11:50:09.237245Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.238183075Z 2025-06-17T11:50:09.237877Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.238579404Z 2025-06-17T11:50:09.238312Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.239012346Z 2025-06-17T11:50:09.238718Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.239638256Z 2025-06-17T11:50:09.239165Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.312573283Z 2025-06-17T11:50:09.312145Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2025-06-17T11:50:09.387223566Z 2025-06-17T11:50:09.386914Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2025-06-17T11:50:09.394142183Z 2025-06-17T11:50:09.393867Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-06-17T11:50:09.394158304Z 2025-06-17T11:50:09.393939Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-06-17T11:50:09.398580272Z 2025-06-17T11:50:09.398376Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2025-06-17T11:50:09.402098092Z 2025-06-17T11:50:09.401817Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-06-17T11:50:09.402432073Z 2025-06-17T11:50:09.402063Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
2025-06-17T11:50:09.402459460Z 2025-06-17T11:50:09.402123Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2025-06-17T11:50:09.402921244Z 2025-06-17T11:50:09.402707Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2025-06-17T11:50:09.402935035Z 2025-06-17T11:50:09.402793Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2025-06-17T11:50:09.403040114Z 2025-06-17T11:50:09.402881Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-06-17T11:50:10.985084425Z 2025-06-17T11:50:10.984796Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.42)  MySQL Community Server - GPL.

从网上找了半天没有找到解决方案,后来想起来之前有也是使用这个镜像,所以就排除了镜像的问题。

后来对比一行一行删除测试发现是外部扩展卷的问题,
使用中横线的时候就是报这个异常

修改成下划线格式就正常了 hive_metastore_data

神奇了个鬼
在这里插入图片描述
有没有大佬出来解释一下原因

http://www.lryc.cn/news/571506.html

相关文章:

  • 服务器带宽小优化建议以及实战操作
  • 【在线五子棋对战】七、数据管理模块实现
  • Java 21 新特性深度解析:虚拟线程、结构化并发来袭!
  • 服务器静态ip,网关不能占用*.*.*.1
  • 【音视频】SIP基础、搭建服务器和客户端
  • Axios 知识点全面总结
  • 详解 MyBatis - Plus 服务层设计:让 CRUD 更高效、业务拓展更灵活——补充
  • React 国际化方案最佳实践调研
  • agentformer论文阅读
  • Python 目录操作详解
  • 6-16阿里前端面试记录
  • 云原生时代配置中心全景解读:从Spring Cloud Config到Nacos深度实践
  • (十八)自然语言处理:从理解到创造
  • Java 时间处理指南:从“踩坑”到“填坑”实战
  • 基于CNN卷积神经网络识别汉字合集-视频介绍下自取
  • C++----剖析stack、queue
  • 唯杰地图文档AI搜索-为二次开发者打造的智能开发助手
  • 山东大学 软件项目管理知识点总结
  • ffmpeg python rgba图片合成 4444格式mov视频,保留透明通道
  • crf FFmpeg
  • EMQX简介
  • arcpy数据分析自动化(3)
  • 如何使用postman
  • 答辩讲解387基于Spring Boot的心理健康管理系统
  • Android 开发问题:android.content.res.Resources$NotFoundException: Resource ID
  • 在 Java 中使用 Apache Tika 读取 doc、docx等格式文件内容
  • python web开发-Flask 重定向与URL生成完全指南
  • 课程1-10笔记
  • Vue3+TypeScript中v-bind()的原理与用法
  • JavaEE->多线程1