After spending a few hours, this is the only real documentation I can find for accessing Cloud SQL from outside of GAE: https://developers.google.com/cloud-sql/docs/external
The problem is, this is for a Java application (via JDBC).
I need to access my Cloud SQL DB from within a PHP, Dart, or NodeJS application. I thought by giving my GCE instance rights to connect to Cloud SQL, this would be easy. But no arrangement of socket strings (using mysql drivers) seems to be effective.
For argument's sake, let's say I'm trying to connect with a PHP app. My mysql connection array looks like this:
(
'driver' => 'mysql',
'unix_socket' => '/cloudsql/project-id:instance-id',
'host' => 'localhost',
'database' => 'dbname',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
)
This is as close as I got, but I'll get a generic "Can't connect to local MySQL server through socket" error.