How to use your own mysql database server with heroku?

According to the Heroku documentation, changing DATABASE_URL is the correct way to go.

If you would like to have your rails application connect to a non-Heroku provided database, you can take advantage of this same mechanism. Simply set your DATABASE_URL config var to point to any cloud-accessible database, and Heroku will automatically create your database.yml file to point to your chosen server. The Amazon RDS Add-on does this for you automatically, though you can also use this same method to connect to non-RDS databases as well.

Here's an example that should work:

heroku config:add DATABASE_URL=mysql://user:password@host/db

You may need to redeploy by making a change and running git push heroku master


By the way, the host is XXXX.amazonaws.com, where XXX is a long host hame that probably changes. If you can add a wildcard, that's the easiest %.amazonaws.com

Tags:

Ruby

Heroku