c9.io - 如何在node.js平台中找到主机地址以建立mysql连接

Ist*_*med 6 mysql node.js cloud9-ide

我正在尝试在Cloud 9 Server中托管我的node.js应用程序.为了建立mysql连接,我需要知道主机地址.

这个页面 说的非常荒谬(我认为我是对的)方式:

Hostname    $IP     The same local IP as the application you run on Cloud9
Run Code Online (Sandbox Code Playgroud)

但是我从哪里获得本地IP?在我发现的文档中没有任何地方.任何的想法 ?

编辑: 我使用127.0.0.1,0.0.0.0(来自echo $IP答案中建议的终端)和终端中的值 hostname -Icurl curlmyip.com.4个不同的IP地址.没有用.

Roc*_*CTZ 1

我在Cloud9 文档中找到了这个:

然后您可以使用以下参数连接到数据库:

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
Run Code Online (Sandbox Code Playgroud)

要查找您的 IP 地址,请打开您的工作区并在 bash 控制台中输入以下内容:

curl http://curlmyip.com/
Run Code Online (Sandbox Code Playgroud)