Google app engine 连接被拒绝-连接到Google Cloud SQL
我有一个Laravel5.3应用程序,我使用Google应用程序引擎部署了它。但是,当我查询数据库时,我会遇到以下错误:Google app engine 连接被拒绝-连接到Google Cloud SQL,google-app-engine,google-app-engine-php,Google App Engine,Google App Engine Php,我有一个Laravel5.3应用程序,我使用Google应用程序引擎部署了它。但是,当我查询数据库时,我会遇到以下错误: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `email` = test+support@loungeroom.nl limit 1) 我的app.yaml文件内容如下: runtime: php env: flex runtime_config: docume
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `email` = test+support@loungeroom.nl limit 1)
我的app.yaml
文件内容如下:
runtime: php
env: flex
runtime_config:
document_root: public
# required on some platforms so ".env" is not skipped
skip_files: false
env_variables:
# The values here will override those in ".env". This is useful for
# production-specific configuration. However, feel free to set these
# values in ".env" instead if you prefer.
APP_LOG: errorlog
STORAGE_DIR: /tmp
MYSQL_DSN: mysql:unix_socket=/cloudsql/zoho-portal-159018:us-central1:zoho-portal;dbname=zoho_portal
MYSQL_USER: adeel
MYSQL_PASSWORD: pass
beta_settings:
cloud_sql_instances: zoho-portal-159018:us-central1:zoho-portal
我已经完成了教程中列出的所有步骤。我还确保启用了我的云SQL API。使用数据库会话驱动程序时,需要设置一个包含会话项的表。下面是该表的模式声明示例:
Schema::create('sessions', function($table)
{
$table->string('id')->unique();
$table->text('payload');
$table->integer('last_activity');
});
您可以找到有关Laravel“会话”的更多详细信息 试着按照这个特定的步骤来做。另外,请尝试在app.yaml中的“cloud\u sql\u instances”连接名称周围使用引号“”,如指南所示。我已按照指南,并根据说明更新了app.yaml文件。但是,我在访问()时遇到此错误:SQLSTATE[HY000][2002]没有此类文件或目录(SQL:select*from
sessions
whereid
=ySejUS01EZ5kRcZQrrFh8RcMdVybiOfVjio9vNW0 limit 1)这可能与数据库的设置方式有关吗?请确保运行的是Laravel 5.4.16,因为在以前的版本中无法识别DB_套接字环境变量。