Monday, June 4, 2018

[google-cloud-sql-discuss] MySQL connection is not working for Laravel at Google Cloud SQL

Hi,

I have been trying to connect the MySQL on google cloud for Laravel application, i have configured the app.yaml file as per the documents featured on internet. But don't know whats wrong with GCloud, it won't connect anyway.

Can someone please help me.


Below is app.yaml file

runtime: php
env: flex
runtime_config:
 document_root: public   #folder where index.php is
# Ensure we skip ".env", which is only for local development
skip_files:
 - .env #we want to skip this to make sure we don't mess stuff up on the server
env_variables:
 # Put production environment variables here.
 APP_ENV:  production
 APP_DEBUG: true
 APP_KEY: base64:5efXAk7MFz9HoBbRP55vxgu6eu+sFeBEOp/lhHzXc6s=
#go to generate app key paragraf in this tutorial
 CACHE_DRIVER: file
# instead of putting the cache in the database I recommend using redis
 SESSION_DRIVER: file
 APP_LOG: daily
 #APP_TIMEZONE: UTC #your timezone of choice
# follow the part of the tutorial on setting up your SQL database
 DB_CONNECTION: mysql
 DB_HOST: localhost
 DB_DATABASE: submit_itr_v1
 DB_USERNAME: root
 DB_PASSWORD: somepassword
 DB_SOCKET: "/cloudsql/<Instance connection name>"
 DB_PORT: 3306
 STORAGE_DIR: /tmp
 MYSQL_DSN: "mysql:dbname=db_name;unix_socket="/cloudsql/intance-connection-name"
 MYSQL_USER: root


Thanks,
Dilip

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/9aac758b-7976-4296-89cb-af86744e4f7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment