title: Minikube MySQL files
body: <p>I am running minikube on my mac using VB. I was able to start a database on minikube using declarative approach. But when I delete the deployment then data is lost. Now my questions are -</p>
  
  <ol>
  <li>Where are all these data is saved?</li>
  <li>How can I change the configuration so that the data is saved on the host (i mean mac)? That way deleting or restarting of pod/deployment won't delete all data.</li>
  </ol>
  
  <p>Here is my yaml file -</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: track-mysql
    labels:
      app: track
  spec:
    ports:
      - port: 3306
    selector:
      app: track
  ---
  apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: mysql-pv
    labels:
      type: local
  spec:
    capacity:
      storage: 5Gi
    accessModes:
      - ReadWriteOnce
    hostPath:
      path: /data/pv001
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: mysql-pvc
    labels:
      app: track
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 5Gi
  ---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: track-mysql
    labels:
      app: track
  spec:
    selector:
      matchLabels:
        app: track
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          app: track
      spec:
        containers:
        - image: mysql:5.6
          name: mysql
          env:
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql
                key: password
          - name: MYSQL_DATABASE
            value: track
          ports:
          - containerPort: 3306
            name: mysql
          volumeMounts:
            - name: mysql-persistent-storage
              mountPath: /var/lib/mysql
        volumes:
        - name: mysql-persistent-storage
          persistentVolumeClaim:
            claimName: mysql-pvc
  </code></pre>
  
  <p>I have checked, on my mac, the data is not on <code>/data/pv001</code></p>