[英]Codeigniter + AppEngine + CloudSQL (HY000/2002): No such file or directory Filename: mysqli/mysqli_driver.php
[英]SQLSTATE[HY000] [2002] Connection refused when deploy on GCP
對於我的部署,我遇到了這個錯誤 SQLSTATE [HY000] [2002] Connection refused (SQL: select * from insurances
order by created_at
desc)。 我通過為服務賦予角色來嘗試本教程https://groups.google.com/g/google-appengine/c/3EYhmYBbsjg中的建議。 我給服務 CLOUD SQL ADMIN 和 EDITOR 角色。 但仍然是同樣的問題。 我有這個錯誤:
SQLSTATE[HY000] [2002] Connection refused(SQL: select * from `insurances` order by `created_at` desc)
這里是app.yaml的配置
runtime: php72
# env: flex
# runtime_config:
# document_root: public
runtime_config:
document_root: public
beta_settings:
cloud_sql_instances: CONNECTION_NAME
env_variables:
APP_KEY: secret
APP_STORAGE: /tmp
VIEW_COMPILED_PATH: /tmp
CACHE_DRIVER: database
SESSION_DRIVER: database
APP_NAME: Tripguard Insurance
DB_CONNECTION: mysql
DB_DATABASE: database
DB_USERNAME: root
DB_PASSWORD: password
DB_SOCKET: "/cloudsql/CONNECTION_NAME"
我已將這些憑據與雲 shell 一起使用,我的查詢正在返回結果。
我按照以下建議解決了我的挑戰: https://cloud.google.com/sql/docs/mysql/connect-run 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.