2

I am trying to connect an instance of nodejs to my google cloud SQL database. its failing.

I run the command

node server.js

and get the error

Problem with MySQL Error: connect ENETUNREACH

here is my server.js file

var gcloud = require("gcloud");
var express = require("express");
var mysql = require("mysql");
var app = express();
var connection = mysql.createConnection({
host : "2001:****:****:*:****:****:****:****",
user : "root",
password : "*****",
database : "scripto_5_k"
});
/* Connection to Database */
connection.connect(function(error){
if(error)
{
console.log("Problem with MySQL "+error);
}
else
{
console.log("Connected with Database ");
}
});
/*start the server */
app.listen(3000,function(){
console.log("its started on PORT 3000");
});

I have gone to my sql database in the developers console and allowed the ip address of my home and the node js instance but I cant seem to find the problem.

Any help is really appreciated.

Update 1

I pinged the IPv6 address with this result

C:\Users\joe>ping 2001:****:****:*:****:****:****:****

Pinging 2001:****:****:*:****:****:****:**** with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 2001:****:****:*:****:****:****:****:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

But I have taken the ip from the properties in the sql tab on gcloud.

1 Answer 1

1

Host address might be wrong. have you tried to ping it?

Sign up to request clarification or add additional context in comments.

1 Comment

I tried to ping it there but got no response. but its the ip is the one on the gcloud sql database. am I doing something wrong? its a IPv6 address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.