Hello Ram,
According to MySQL documentation [1], this error is thrown when a network connection has been refused. If you are using a private IP, then make sure your Compute Engine instance is in the same region as the Cloud SQL instance and on the network configured for a private connection. You can follow these guidelines [2] for private IP connection, or these steps [3] for public IP. If you have enabled SSL on the instance, here is how to set this up for proper connections [4].
[1] https://dev.mysql.com/doc/refman/5.7/en/can-not-connect-to-server.html
[2] https://cloud.google.com/sql/docs/mysql/connect-compute-engine#connecting_using_private_ip
[3] https://cloud.google.com/sql/docs/mysql/connect-compute-engine#gce-connect-ip
[4] https://cloud.google.com/sql/docs/mysql/connect-admin-ip#connect-ssl