Forum archive › MySQL / MariaDB
Archive[ERROR] --initialize specified but the data directory has files in it. Aborting.
Problem
User trying to deploy pod of mysql in kubernetes and get the following error when running the command “kubectl logs mysql-pod”
Solution
The directory of the mysql data i.e. /var/lib/mysql. has data or some other directories in it and the pod cannot start you need either to remove persistent volume and image from the kubernetes or mount the data directory in another dir for example
containers:- name: mysqlimage: “{{ .Values.mysql.image.registry }}/{{ .Values.mysql.image.repository }}:{{ .Values.mysql.version }}”args:- “–ignore-db-dir=lost+found”imagePullPolicy: Alwaysenv:- name: MYSQL_ROOT_PASSWORDvalue: root- name: MYSQL_DATABASEvalue: productionports:- containerPort: 3306name: mysqlvolumeMounts:- name: mysql-{{ .Release.Namespace }}mountPath: /var/lib/mysqld
helm delete mysql-services -n database-serviceshelm upgrade –install mysql-services -n databases-services -f dte.yaml . –create-namespace –set mysql.db_file=all.databases.sql.gz
We do this for a living.
Kubernetes, DevOps and platform engineering, delivered in days — not another weekend lost to a stack trace.
Start a project →