Gcloud app deploy SQLSTATE[HY000] [2002] No such file or directory

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 10:14:07

问题


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"

回答1:


Can you try removing the DB_SOCKET environment variable? The error you are getting is because that socket does not exist.

You should not specify both a DB_HOST and DB_SOCKET, just either of them.




回答2:


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.

You can find more info here https://cloud.google.com/sql/docs/mysql/diagnose-issues



来源:https://stackoverflow.com/questions/57130208/gcloud-app-deploy-sqlstatehy000-2002-no-such-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!