<p>I am trying to run mysql 5.7 in kubernetes and got this error
<code>mysql: unknown option '--&quot;'</code></p>
<p>My database.yaml looks like this</p>
<pre class="lang-yaml prettyprint-override"><code>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
</code></pre>
<p>Maybe I missed something?</p>
<p>I tried to switch versions, tried to use samples from the official Kubernetes site - nothing works for me.</p>
<p>The last logs with error:</p>
<pre class="lang-sh prettyprint-override"><code>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 '--&quot;'
</code></pre>

<p>I ran into the same issue and after a lot of frustrating debugging I finally solved it.</p>
<p>The problem was that I created my secrets with the <code>echo 'secret' | base64</code> command and the echo command automatically inserts a trailing newline.</p>
<p>Use <code>echo -n 'secret' | base64</code> instead. ✔️</p>
<p>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.</p>
