Last Updated: February 25, 2016
· dperrymorrow

Using External Database with Heroku

Heroku is awsome as long as you dont need a large database or background jobs, then it gets expensive really quick.

Want to use an external database with heroku? It's pretty easy.

heroku config:add DATABASE_URL=mysql://user:pass@server:port/database_name

which is equivalent to...


this will setup your production database settings with the supplied information.

5 Responses
Add your response


Was hunting for exactly this. Thanks for the information.
Yep, the 10K limit for a free database on Heroku is like just for testing purposes.

over 1 year ago ·

glad you found it useful,

over 1 year ago ·


over 1 year ago ·

Wait, does that mean that Heroku leaves the ports open to the public?!?

over 1 year ago ·

no i think it would be the other way around, you would have to have your database open to the outside to let your heroku app reach it.

when i did this it was a clear db mysql add on to heroku.

over 1 year ago ·