MySQL with Persistent Volume Claim on Kubernetes

11/15/2019

I created a volume and a persistent volume claim. Then I create a MySQL with a map to this volume claim. But the MySQL container does not start because: "2019-11-15T15:08:57.611908Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting." Nevertheless, this is a fresh volume just created into which I have not added anything. How come there is something in it. How to clean it? Thanks for any suggestions. C

-- Christian68
kubernetes
mysql
persistent-volume-claims

1 Answer

11/15/2019

Thanks. Actually, found workaround solution: used the yaml for pod creation that is given here https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ Then logged into the pod, went to the directory and indeed, there was a "lost+found" directory which I believe is automatically created by Kubernetes. Removed this directory and ensure it is empty. Then started my mysql again ... and it worked.

-- Christian68
Source: StackOverflow