0
我有一個使用Google Application Engine部署的Laravel 5.3應用程序。然而,當我查詢我的數據庫,我面臨着以下錯誤:拒絕連接 - 連接到Google Cloud SQL
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `email` = [email protected] 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
我已按照this教程中列出的所有步驟。我也確保我的Cloud SQL API已啓用。
請嘗試遵循此特定[Laravel on GAE Flex指南](https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible)。也可以嘗試在app.yaml中的'cloud_sql_instances'連接名稱周圍使用引號''',如指南所示。 – Jordan
我已按照指示進行操作,並根據說明更新了我的app.yaml文件。我訪問時發生錯誤(https://zoho-portal-159018.appspot.com/): SQLSTATE [HY000] [2002] No such file or directory(SQL:select * from'sessions' where'id' = ySejUS01EZ5kRcZQrrFh8RcMdVybiOfVjio9vNW0限制1) 這可能與數據庫的設置有關嗎? –