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.
Host address might be wrong. have you tried to ping it?