Home > Mobile >  The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server
The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server

Time:01-18

I am running Minikube version 1.20 w/ KVM2 as a VM driver inside my Ubuntu 20.04 LTS. When I am trying to deploy SQL inside my local Kubernetes cluster. It keeps restarting with the below pod logs error

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.

I am trying to use mysql:8 image and mountPath: /var/lib/mysql.

CodePudding user response:

Seems like the volume contains something from the error. You can try to delete the pod and related resources (e.g. PVC, service, etc), delete the data directory and any files within it. After, create the pod again and make sure that the data directory is empty and not being used by any other pod or service and make sure that the mountPath: /var/lib/mysql should be empty before the pod creation.

CodePudding user response:

If you tried multiple times i would suggest trying deleting everything first and applying changes again PV and PVC. There could be changes in PVC, PVC old files exist which causes issues.

Try deploying everything again and also check MySQL image.

You can refer this for more info : https://stackoverflow.com/a/70800469/5525824

  • Related