title: App engine fails to connect to Google cloud sql
body: <p>My Google app engine application fails to connect to Google cloud sql instance with this error:</p>
  
  <pre><code>'PDOException' with message 'SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
  </code></pre>
  
  <p>I've checked the documentation and followed instructions closely. I added the app as an authorised application and set the root password using the cloud console. I also gave the instace an ip address and can connect to it from Workbench on the local development machine. Using workbench, I added a user and configured permissions. But I'm still unable to connect to it from the dev version of the app (same ip as workbench) or the deployed app.</p>
  
  <p>Here's my connection line:</p>
  
  <pre><code>$conn = new PDO('mysql:unix_socket=/cloudsql/****:****;charset=utf8', 'the_username', 'its_password');
  </code></pre>
  
  <p>this <a href="https://stackoverflow.com/questions/19751416/cloudsql-pdounix-socket-problems-on-google-app-engine?rq=1">question</a> appears to be similar to this problem. However, even after setting up a new user and granting permissions I'm still unable to connect. Any idea where I went wrong?</p>
  
  <p>Thanks</p>