google-cloud-sql: Name or service not known

202 views
Skip to first unread message

Ali Jutt

unread,
Oct 3, 2020, 7:45:04 PM10/3/20
to Google Cloud SQL discuss
Hye 
I want to connect mysql db with my php project I have created the db and uploaded the project but unable to get data or run any query Here is what I get the error when I var_dump my connection variable

object(mysqli)#1 (19) {
  ["affected_rows"]=>
  bool(false)
  ["client_info"]=>
  bool(false)
  ["client_version"]=>
  int(50012)
  ["connect_errno"]=>
  int(2002)
  ["connect_error"]=>
  string(71) "php_network_getaddresses: getaddrinfo failed: Name or service not known"
  ["errno"]=>
  bool(false)
  ["error"]=>
  bool(false)
  ["error_list"]=>
  bool(false)
  ["field_count"]=>
  bool(false)
  ["host_info"]=>
  bool(false)
  ["info"]=>
  bool(false)
  ["insert_id"]=>
  bool(false)
  ["server_info"]=>
  bool(false)
  ["server_version"]=>
  bool(false)
  ["stat"]=>
  bool(false)
  ["sqlstate"]=>
  bool(false)
  ["protocol_version"]=>
  bool(false)
  ["thread_id"]=>
  bool(false)
  ["warning_count"]=>
  bool(false)
}

Katayoon (Cloud Platform Support)

unread,
Oct 4, 2020, 2:39:59 PM10/4/20
to Google Cloud SQL discuss
Hi,

Could you provide more clarification on the steps you have taken to connect to the Cloud SQL instance? 

Are you trying to connect to the instance from your App Engine app? If so, you may double check the steps you have taken with this public documentation and if the issue still persists we need the REDACTED app.yaml to dig into the issue. 

Ali Jutt

unread,
Oct 6, 2020, 12:30:06 PM10/6/20
to google-cloud...@googlegroups.com
Hye
First of all I exported mysql db from localhost created an instance on cloud mysql and then using shell imported the tables.
This is how I am creating connection

mysql_connect('/cloudsql/'.$connection_name, $username, $password, $db);

After creating a connection I run the command gcloud app deploy and deploy the connection file and index file but when I run the query I couldn,t get the data this is my query.

$query_string  = "SELECT * FROM users;";
$result = mysql_query($conn,$query_string);

but I get $result as false

--
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-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/76994535-760c-48e8-9183-b5f3e94b300en%40googlegroups.com.

Kevin (Cloud Platform Support)

unread,
Oct 6, 2020, 8:34:21 PM10/6/20
to Google Cloud SQL discuss
Hello,

In order to receive the most efficient means of assistance, we would recommend inquiring about this technical issue on the corresponding Stack Overflow community topic through submitting a new question.

The Question and Answer format is much more suitable for technical issues and would allow for more suitable answers and explanations for the behavior seen here, and as it is more suitable, more community members will likely lend a helping hand.
Reply all
Reply to author
Forward
0 new messages