指定的数据目录/var/lib/mysql/不可用,您可以在Kubernetes Pod中删除服务器添加到该目录的所有文件

aij0ehis  于 2023-01-20  发布在  Mysql
关注(0)|答案(2)|浏览(179)

我正在Ubuntu 20.04 LTS中运行Minikube版本1.20 w/KVM2作为VM驱动程序。当我尝试在本地Kubernetes集群中部署SQL时。它不断重新启动并显示以下pod日志错误

2023-01-17 07:15:17+00:00 [Note] [Entrypoint]: Initializing database files
2023-01-17T07:15:17.153897Z 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.
2023-01-17T07:15:17.154020Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-01-17T07:15:17.154036Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 42
2023-01-17T07:15:17.155532Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2023-01-17T07:15:17.155536Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-01-17T07:15:17.155571Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-01-17T07:15:17.155647Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31)  MySQL Community Server - GPL.

我正在尝试使用mysql:8映像和安装路径:/var/lib/mysql .

xlpyo6sf

xlpyo6sf1#

卷似乎包含错误中的某些内容。您可以尝试删除pod和相关资源(例如PVC、服务等),删除数据目录和其中的任何文件。之后,再次创建pod,确保数据目录为空且未被任何其他pod或服务使用,并确保mountPath:在创建pod之前,/var/lib/mysql应该为空。

qf9go6mv

qf9go6mv2#

如果您尝试多次,我建议您先尝试删除所有内容,然后再次应用更改PVPVCPVC中可能存在更改,PVC旧文件存在,这会导致问题。
尝试重新部署所有内容,并检查MySQL映像。
您可以参考此获取更多信息:https://stackoverflow.com/a/70800469/5525824

相关问题