Tuesday, February 11, 2020

[google-cloud-sql-discuss] Re: PHP PDO not Connecting to Cloud SQL

Hello Aminu, 

You may consider something similar to: 

$dsn = "/cloudsql/PROJECT:REGION:INSTANCE;dbname=DATABASE";
 $user = "USER";
 $password = "PASSWORD";
 $db = new PDO($dsn, $user, $password);

Alternatively, you could set relevant environment variables in the app.yaml configuration file, and using these variables: 

env_variables:

MYSQL_USER: root

MYSQL_PASSWORD: "*****"

MYSQL_DSN: mysql:dbname=DBNAME;unix_socket=/cloudsql/INSTANCE_NAME

This discussion group is oriented more towards general opinions, trends, and issues of general nature touching App Engine and Cloud SQL. For coding and programming architecture, as well as setting up PDO connectivity, you may be better served in dedicated forums such as stackoverflow, where experienced programmers are within reach and ready to help. 

--
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/60301eb6-3edb-4189-89ce-7dbec071d36d%40googlegroups.com.

No comments:

Post a Comment