Connecting to 2nd gen Cloud SQL on App Engine flex

2019-07-11 06:53发布

问题:

I decided to try out PHP 7 on App Engine and have followed instructions here to connect to second gen Cloud SQL but I'm unable to get it working.

As a testing script I decided to upload PhpMyAdmin and got the following error upon attempting to login:

Then I decided to go into debug mode and see what's going on. Turns out that the proxy container is running, the /cloudsql/ folder is created but there is no socket there:

Here is my app.yaml:

runtime: php
env: flex

manual_scaling:
    instances: 1

env_variables:
    CLOUDSQL_UNIX_SOCKET: /cloudsql/project-161108:us-east1:clod-sql-test

beta_settings:
    cloud_sql_instances: "project-161108:us-east1:clod-sql-test"

Here is Cloud SQL instance info (yes, I misspelled cloud when creating it):

My question is: how can I make the socket appear where it's supposed to be? I've spent 2 days trying to fix this, any advice would be appreciated....

回答1:

My hypothesis is that the Google Cloud SQL API is not enabled.

Go to the following link and see if it's enabled. Enable it if not.

https://console.cloud.google.com/apis/api/sqladmin.googleapis.com/overview?project=_

Then try re-deploying the app (unfortunately you need to deploy it again).