Pages

Monday, May 5, 2014

configure mysql database in herokuapp for free

(1)Login to www.herokuapp.com website with your username and password.
(2)Select add-ons link
(3)From datastores select mysql cleardb database,click on that.
(4)select plan ignite(free plan)
(5)Now just link your database to your current app of heroku that you created eariler.for example yourname.herokuapp.com.for that at right bottom of https://addons.heroku.com/cleardb webpage,select your app from dropdown list and click add ignite for free.



(6)You have successfully created your database for herokuapp.
(7)Go to commad prompt in your system
(8)change folder to heroku where you had put your heroku website data.
(9)type : heroku config | grep CLEARDB_DATABASE_URL
(10)You will get output like below:

CLEARDB_DATABASE_URL: mysql://<Your database username>:<Your database password>@<Your hostnamewheredb is configured>/<DATABASE NAME>?reconnect=true

This will help you to connect this DB with your website.
(11)Now restore your created database from you local system to heroku cleardb database server with mysql dump & restore commands as you all know.




(12)You have now successfully uploaded and connected your database to your website.
(13)For development purpose heroku increment database id value by 10.e.g If first record has id 1 then second record id will be 11 and then 21,31,41,51... and so on.

Shell Script Code