I am trying to run mysql 5.7 in kubernetes and got this error
mysql: unknown option '--"'
My database.yaml looks like this
apiVersion: v1
kind: Pod
metadata:
name: app-db
labels:
app: app-db
spec:
containers:
- name: mysql
image: mysql:5.7
ports:
- name: mysql-port
containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: app-secrets
key: rootPassword
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: app-secrets
key: username
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: app-secrets
key: password
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: app-secrets
key: defaultDatabase
Maybe I missed something?
I tried to switch versions, tried to use samples from the official Kubernetes site - nothing works for me.
The last logs with error:
2020-07-19 20:51:01 100 [Note] Event Scheduler: Loaded 0 events
2020-07-19 20:51:01 100 [Note] mysqld: ready for connections.
Version: '5.6.49' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL)
2020-07-19 20:51:01+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2020-07-19 20:51:04 100 [Warning] 'proxies_priv' entry '@ root@app-db' ignored in --skip-name-resolve mode.
2020-07-19 20:51:04+00:00 [Note] [Entrypoint]: Creating database app_db
mysql: unknown option '--"'
I ran into the same issue and after a lot of frustrating debugging I finally solved it.
The problem was that I created my secrets with the echo 'secret' | base64
command and the echo command automatically inserts a trailing newline.
Use echo -n 'secret' | base64
instead. ✔️
Unfortunately this was not at all what I expected and therefore I didn't notice that there was a line break in the log output. Hopefully this can help some people who also use the echo command to encode to base64.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With