title: Linking Google Compute Engine and Google Cloud SQL
body: <p>**Frustrated by the lack of clear documentation for Google cloud compute engine (GCE) and integration with Google cloud SQL and especially linking the two. No live support, and current documentation lacks clarity by continuing to refer to Google App Engine. The documentation on Google App Engine references linking but no clear process for creating a link between VM Instance (in Compute Engine - GCE) and Google SQL on the same project in the Google Cloud (again both on Google Cloud). </p>
  
  <p>I have installed Centos 7 VM (64) with Mariadb, MariaDB server and PHP with all connectors. I have tested all localhost call and all are working.</p>
  
  <p>In Access Control on Google SQL:</p>
  
  <ol>
  <li><p>Directions seem to indicate using socket and then using root for PHP application ?</p>
  
  <ul>
  <li>seems rather un-secure. Versus using root for admin then having app run limited permissions user in a limited database. Need different software components to have different Database and Table Access.</li>
  </ul></li>
  <li><p>When establishing a user with privileges in mySQL from CLI does Access Control require the same user setup up with same settings?</p></li>
  <li><p>When setting up SSL on Cloud SQl, should not the SSL be auto-populated to compute engine or do I need to set up the key files in compute engine as well. I have tried with this setting off (need very secure data transfer). But still no joy.</p></li>
  <li><p>In testing PHP access I, as of yet, have NOT gotten a data call to work,
  even using instructions found here: <a href="https://stackoverflow.com/questions/19352528/accessing-google-cloud-sql-instance-from-google-compute-engine">Accessing Google Cloud SQL instance from Google Compute Engine?</a></p></li>
  </ol>
  
  <p><strong>EDIT - SOLVED</strong> - Thanks to David below and link mentioned in comment below.</p>
  
  <p>Follow directions below and add following steps:</p>
  
  <ul>
  <li><p>a. After user is created on Developers Console in Cloud SQL, use CLI, HEIDI, mySQL Workbench or something similar to connect to Instance and set specific database privileges by adjusting the user already created.</p></li>
  <li><p>b. Then return to VM (GCE) instance via SSH and adjust Apache/SELinux by allowing remote mysql - see this link: <a href="https://stackoverflow.com/questions/4078205/php-cant-connect-to-mysql-with-error-13-but-command-line-can">php can&#39;t connect to mysql with error 13 (but command line can)</a></p></li>
  <li><p>c. Install a TEST mysqli or PDO connector and check for errors.</p></li>
  <li><p>d. Voila</p></li>
  </ul>