This is old but in case anyone drops around looking for an answer, it's much easier than using the gem. Just provide a DATABASE_URL
and SHARED_DATABASE_URL
(not sure if the second is needed). The database url format is adapter://username:password@hostname:port/database
, so for example, you would do:
heroku config:add DATABASE_URL=mysql://etok:somepassword@<your-server>:3306/etok
heroku config:add SHARED_DATABASE_URL=mysql://etok:[email protected]:3306/etok
Then re-deploy your app. It will read your DATABASE_URL
and generate the database.yml from that. The default port is already 3306 so it's not needed in the url in your case. When you deploy, you may notice that it generates your database.yml:
-----> Writing config/database.yml to read from DATABASE_URL
Then you're set (as long as your server accepts connections from your heroku host.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…