<p>I'm setting up a MySQL service on an Openshift container, but I can't access it from the rest of the services.</p>

<p>According to the documentation (<a href="https://docs.openshift.com/online/dev_guide/environment_variables.html#automatically-added-environment-variables" rel="nofollow noreferrer">https://docs.openshift.com/online/dev_guide/environment_variables.html#automatically-added-environment-variables</a>), when a service is created, the <code>X_SERVICE_HOST</code> and <code>X__SERVICE_PORT</code> environment vbles are populated to the rest of the services, but I can't seem to be able to access them from my Java service (using the <code>${MYSQL_SERVICE_HOST}</code> placeholder on a <code>.properties</code> file).</p>

<p>Previously I had been able to connect to a MySQL db using the <code>Cluster IP</code> value on the service definition, but it doesn't work either, I have tried to import the mysql secret on my Java service, which is supposed to import the env variables such as username, pwd, etc. but it doesn't import the hostname and port.</p>

<p>As stated in this thread (<a href="https://github.com/openshift/origin/issues/10401" rel="nofollow noreferrer">https://github.com/openshift/origin/issues/10401</a>) I have tried to create a MySQL service named <code>MYSQL</code>, but it fails due to the upper casing.</p>

<p>How should I propagate the env vbles to other services?</p>

<p>Thank you.</p>

<p>Edit: The issue was finally solved, the MySQL URL connection format was wrong, and it contained an extra <code>/</code> somewhere, after I fixed that the vbles propagated correctly.</p>

GCarbajosa
<p>Ordering may be the issue here. I believe the service will need to be created before any of the deployment configs, replication controllers etc that consume them as env vars.</p>
