Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c9.io - how to find the host address to make a mysql connection in node.js platform

I am trying to host my node.js app in Cloud 9 Server. In order to make a mysql connection, I need to know the host address.

This page says in a very absurd (I think I am right ) way :

Hostname    $IP     The same local IP as the application you run on Cloud9

But where do I get the local IP from ? Nowhere in the docs I found it. Any idea ?

EDIT : I used 127.0.0.1 , 0.0.0.0( from echo $IP in the terminal as suggested in an answer) and the values from hostname -I and curl curlmyip.com in the terminal. 4 different IP addresses. None worked.

like image 248
Istiaque Ahmed Avatar asked Jan 13 '15 21:01

Istiaque Ahmed


People also ask

How do I create a mysql connection pool in node JS?

Nodejs MySQL Integration: Pool Connectionsvar pool = mysql. createPool({ connectionLimit: 7, host: 'localhost', user: 'root', password: '', database: 'todoapp' });


1 Answers

I found this on the Cloud9 documentation:

You can then connect to the database with following parameters:

Option      Value      Comment
Hostname    $IP     The same local IP as the application you run on Cloud9
Port        3306       The default MySQL port number
User        $C9_USER    Your Cloud9 user name
Password    -          No password since you can only access the DB from within the workspace
Database    c9         The database name

To find out your IP address, open your workspace and type this in the bash console:

curl http://curlmyip.com/
like image 56
Roco CTZ Avatar answered Sep 27 '22 21:09

Roco CTZ