Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use your own mysql database server with heroku?

Tags:

ruby

heroku

I want to use mysql database which is hosted on my own server. I've changed DATABASE_URL and SHARED_DATABASE_URL config vars to point to my server, but it's still trying to connect to heroku's amazonaws servers. How do I fix that?

like image 311
Arty Avatar asked Jan 16 '11 21:01

Arty


1 Answers

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

like image 170
Andy Lindeman Avatar answered Nov 15 '22 06:11

Andy Lindeman