Can I use openssl s_client to retrieve the CA certificate for MySQL?
<p>Can I use <code>openssl s_client</code> to retrieve the CA certificate for MySQL?</p>

<p>I have access to the remote database server using the following</p>

<pre><code>mysql -u theuser -h thehost --ssl --ssl-cipher=DHE-RSA-AES256-SHA -p thedatabase
</code></pre>

<p>Now I want to do to connect to it using JDBC. </p>

<p>I realize that I need to <a href="https://stackoverflow.com/a/27536391/266531">insert the public certificate into my Java key store</a>. However, I cannot figure out how to retrieve the public certificate. I realize it sits on the remote server in <code>/etc/mysql/ca.pem</code> or a similar place. But, I don't have permission to read that file or even <code>ssh</code> into the machine.</p>

<p>I've tried</p>

<pre><code>openssl s_client -cipher DHE-RSA-AES256-SHA  -connect thehost:3306
</code></pre>

<p>and some variations. I always get errors. For example</p>

<pre><code>CONNECTED(00000003)
30495:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:/BuildRoot/
Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-59/src/ssl/s23_clnt.c:618:
</code></pre>