I am trying to write a simple plain PHP page, that connects to Cloud SQL using mysqli. It works fine on my local machine, when I turn on the Cloud SQL proxy. BUT! it does not work on the Google App Engine. I have tried:
- changing 127.0.0.1 to the Public IP address stated in the Cloud SQL instance details
adding the port (3306), and db socket (
/cloudsql/<cloud_sql_instance_name>
)$servername = "127.0.0.1"; $username = "test"; $password = "test"; $dbname = "testdb"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "\nConnected successfully\n";
Is there any mistake somewhere?