<p>Friends, I am trying to implement a readinessProbe here like this:</p>
<pre><code>readinessProbe:  
  exec:
    command: [&quot;mysql&quot;, &quot;-u root&quot;, &quot;-p $(MYSQL_ROOT_PASSWORD)&quot;, &quot;SHOW DATABASES;&quot;]
    initialDelaySeconds: 5
    periodSeconds: 2
    timeoutSeconds: 1
</code></pre>
<p>But I am getting an access denied error: <strong>ERROR 1045 (28000): Access denied for user ' root'@'localhost' (using password: YES)</strong></p>
<p>When I exec inside my pod, I can connect to the database normally so I think I am doing something wrong by the execution the the connection commands. Any idea how can I solve this problem?</p>

marcelo
<p>When you use JSON-array syntax for <code>command:</code> and similar options, you specify exactly how the command is split up into &quot;words&quot;.  So when the option says</p>
<pre class="lang-yaml prettyprint-override"><code>command: [..., &quot;-u root&quot;, ...]
</code></pre>
<p>That is a single option containing an embedded space (I might say aloud &quot;dash u space root&quot;).  In an interactive shell it'd be the equivalent of quoting the option <code>mysql '-u root' ...</code>.</p>
<p>From your error message, it looks like the <code>mysql</code> client tool interprets the space as part of the user name; you don't want that.  Either split it yourself into two separate options, or remove the space between the option and the argument.</p>
<pre class="lang-yaml prettyprint-override"><code>command: [..., &quot;-u&quot;, &quot;root&quot;, ...]
command: [..., &quot;-uroot&quot;, ...]
</code></pre>
