I have a Google App Engine application that is running, database is set up and should be working (works with development server), but cannot connect to the database when the app is deployed. I get the following error:
Warning: PDO::__construct(): MySQL server has gone away in /base/data/home/apps/s~helloworldtmb/1.382580389844400668/guestbook.php on line 26
Warning: PDO::__construct(): Error while reading greeting packet. PID=-1 in /base/data/home/apps/s~helloworldtmb/1.382580389844400668/guestbook.php on line 26 {"outcome":false,"message":"Unable to connect."}
line 26 is
$db = new pdo('mysql:unix_socket=/cloudsql/<helloworldtmb>:<helloworldtmb:helloo>;dbname=guestbook', 'root', 'p');
helloworldtmb
is the application id and helloworldtmb:helloo
is the instance name. any ideas?
从项目ID和Cloud SQL实例名称中删除尖括号
You didn't remove the <angle brackets>
when filling in the template from the docs you followed . Usually, when programming, when you see angle-brackets with words inside like "your app id" or "your database name", you'll want to interpret the angle-brackets as defining the start and end of where your string should be. So,
/home/<your username>/.ssh/
Would become
/home/anon/.ssh/
And
curl -X <request method> <url>
Would become
curl -X GET http://v1-dot-api.domain.com/threads/list
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.