question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to connect to Cloud SQL

See original GitHub issue

I can’t connect from App Engine to Cloud SQL by unix socket nor by TCP.

var mysql = require('mysql');
var mysqlConf = {
  user: 'root',
  password: '',
  socketPath: '/cloudsql/<appli-id>:<instance>',
  database: 'myDb'
};

connection = mysql.createConnection(mysqlConf);

connection.connect(function(err) {
  if (err)
    return callback(err);
  return callback();
});

it throws :

   Error: connect ENOENT
        at exports._errnoException (util.js:746:11)
        at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1000:19)

I’m using Nodejs 4.1.1.

Also I have no problem to connect to Cloud SQL from my localhost through TCP.

Am I missing something?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
jmdobrycommented, Sep 17, 2017

This is probably a better tutorial for connecting to Cloud SQL: https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql

3reactions
mm-wangcommented, Sep 28, 2016

Can someone post an example of using a socketPath that uses TCP and Google Cloud SQL with a proxy?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging connection issues | Cloud SQL Documentation
Common connection issues · Verify that your application is closing connections properly · Verify that your certificates have not expired · Verify that...
Read more >
Cannot connect Google Cloud SQL in MySql Workbench
Go to your sql instance · Go to Connections tab · Under Connectivity select public IP and add a network by giving CIDR...
Read more >
Unable to connect to CloudSQL instance using IP address if ...
1. Go to the "Access Control" page for the CloudSQL instance in the management UI. 2. Check "Only allow SSL connections" on the...
Read more >
Unable to connect cloud SQL postgres
Any help should appreciated, I have been trying to connect prostgres DB instanc using python3.5 , Flask using sqlalchemy, Used below line to...
Read more >
How to Connect to GCP Cloud SQL Instances in ...
Since both Cloud SQL and Cloud Run are on the Google Cloud Platform, it's better to connect by private IP for minimum network...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found