If you can have an empty config/database.yml file then define ENV['DATABASE_URL'] variable, then It will work
$ cat config/database.yml
$ echo $DATABASE_URL
mysql://root:[email protected]:3306/my_db_name
for Heroku:
heroku config:set DATABASE_URL='mysql://root:[email protected]/my_db_name'