Heroku Node.js Remote Mysql Database IP Address


I have a remote Mysql database that I am connecting to through Node.js on Heroku. My MySql host (bluehost) wants me to input IP Adresses of all remote MySql connections.

Heroku doesn't have a dedicated IP for my app, so how can I connect to it? Bluehost mentions something about a Class C IP on its page, but I'm not sure Heroku has one...

Also, I believe I already have all of the heroku environment variables set up correctly:

(heroku config:add EXTERNAL_DATABASE_URL=...)

Thanks :D

Problem courtesy of: Sam


Here's what blue host says about dynamic ip addresses:

Dynamic IP Addresses

Having a dynamic IP address means that the connecting IP address can change periodically depending on the Internet Service Provider (ISP). You must update the connecting IP in Remote MySQL every time it changes.

from https://my.bluehost.com/cgi/help/89.

So at least each time you redeploy your application, you have a chance to get a different ip address. So this seems highly impractical. Why don't you use Heroku's MySQL offering?

Solution courtesy of: Pascal Belloncle


You can use one of 'static ip' addons and proxy connection via that static ip - see this discussion

Discussion courtesy of: Andrey Sidorov

This recipe can be found in it's original form on Stack Over Flow.