问题描述
我已经有一个运行正常的laravel项目,该数据库在我的本地主机中.但是,当我使用GCP应用程序引擎时,我将遵循数据库连接步骤.我已经在我的云中创建了mysql数据库,并从工作本地数据库中导入了所有sql.当我部署应用程序时,显示SQLSTATE [HY000] [2002]下面的文件或目录没有我的app.yaml文件内容
I already have a working laravel project with database in my local host. But when i use GCP app engine i follow the step with database connection. I already create mysql database in my cloud and imported all my sql from working local database. When i app deploy the shows SQLSTATE[HY000] [2002] No such file or directory below are my app.yaml file content
runtime: php
env: flex
runtime_config:
document_root: public
# Ensure we skip ".env", which is only for local development
skip_files:
- .env
env_variables:
# Put production environment variables here.
APP_LOG: errorlog
APP_KEY: <app-key>
CACHE_DRIVER: database
SESSION_DRIVER: database
## Set these environment variables according to your CloudSQL configuration.
DB_HOST: <db_host>
DB_DATABASE: info
DB_USERNAME: root
DB_PASSWORD: <db_pass>
DB_SOCKET: "/cloudsql/lkcfes:asia-east1:lkcfes"
beta_settings:
# for Cloud SQL, set this value to the Cloud SQL connection name,
# e.g. "project:region:cloudsql-instance"
cloud_sql_instances: "lkcfes:asia-east1:lkcfes"
推荐答案
根据您的配置以及最后的注释,由于网络错误,您没有到达实例.我认为您应该在GCP控制台中查看防火墙配置,并在实例配置中查看授权网络".
According to your configuration, and the last comment, you are not reaching the instance due a network error. I think you should review your firewall configuration in GCP console and the "authorized networks" in the instance configuration.
您可以在此处找到更多信息 https://cloud.google.com/sql/docs/mysql/diagnose-issues
You can find more info here https://cloud.google.com/sql/docs/mysql/diagnose-issues
这篇关于Gcloud应用程序部署SQLSTATE [HY000] [2002]没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!