title: Connecting to a MySQL container in the same pod
body: <p>Good day,</p>
  
  <p>I am using Kubernetes to run containers on the google container engine.</p>
  
  <p>The idea is to run two containers in a pod. One container uses the docker mysql image, the other runs php, laravel, nginx and composer.</p>
  
  <p>Locally, this works. The idea is that the php can connect to the database on localhost, and this should work if both containers are in the same pod. However, when the pod is launched, we see the following message in the log:</p>
  
  <pre><code>SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
  </code></pre>
  
  <p>The only difference is that when testing locally, I change localhost to the internal docker ip.</p>
  
  <p>Thanks and good day</p>