从外部应用程序连接到Google Cloud SQL

时间:2016-12-15 14:47:12

标签: google-app-engine google-cloud-sql

我已按照说明操作:https://cloud.google.com/sql/docs/external

STEP1. $ chmod +x ~/GCP/cloud_sql_proxy

STEP2. $ gcloud auth application-default login

STEP3. $ ./cloud_sql_proxy -instances=[INSTANCE_CONNECTION_NAME]=tcp:3306 -credential_file=[PATH_TO_KEY_FILE]

我得到了2016/12/15 19:55:44 Ready for new connections

STEP4. $ mysql -u root -h 127.0.0.1 -p

但我在终端中收到以下错误;

2016/12/15 23:51:20 New connection for "[INSTANCE_CONNECTION_NAME]"
2016/12/15 23:51:20 Thottling refreshCfg([INSTANCE_CONNECTION_NAME]): it was only
called 23.918136971s ago
2016/12/15 22:08:26 couldn't connect to "[INSTANCE_CONNECTION_NAME]": 
Post https://www.googleapis.com/sql/v1beta4/projects/{PROJECT_ID]/
instances/[INSTANCE_NAME]/createEphemeral?alt=json: private key should be a PEM or
plain PKSC1 or PKCS8; parse error: asn1: syntax error: sequence truncated
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial 
communication packet', system error: 0

我被困在这里。 感谢您的所有帮助。

1 个答案:

答案 0 :(得分:0)

create a service account是否具有编辑角色并下载了私钥?