Heroku allows applications to be hosted which need database. Either mysql or postgresql can be used, it is easier to host an application which uses postgres hence we shall be using the same.
To use postgresql you may want to check this .
After logging in to your heroku account in the terminal (check this) add an addon for the current app by
using $ heroku addons:add heroku-postgresql:dev
Then login to your account and check the app, your database can be observed here.
You can then use the host,database,user and password information in your application to access the tables in the database.
use $ su postgresql_username
to login to postgresql .
Then to access the remote database on heroku , use
$ psql -h host -U user database
(note: here host,user and database implies those indicated in the image or the details from here.)
Now you are logged in. you can now enter create table etc sql commands to be executed on the remote server.
The table can then be accessed in the application.But note that the database in psql and not mysql.
if your app is using mysql, then convert mysql to psql replace the following set of instructions:
mysql_connect to pg_connect
mysql_query to pg_query
mysql_fetch_row to pg_fetch_row
and so on.
To use postgresql you may want to check this .
After logging in to your heroku account in the terminal (check this) add an addon for the current app by
using $ heroku addons:add heroku-postgresql:dev
Then login to your account and check the app, your database can be observed here.
You can then use the host,database,user and password information in your application to access the tables in the database.
use $ su postgresql_username
to login to postgresql .
Then to access the remote database on heroku , use
$ psql -h host -U user database
(note: here host,user and database implies those indicated in the image or the details from here.)
Now you are logged in. you can now enter create table etc sql commands to be executed on the remote server.
The table can then be accessed in the application.But note that the database in psql and not mysql.
if your app is using mysql, then convert mysql to psql replace the following set of instructions:
mysql_connect to pg_connect
mysql_query to pg_query
mysql_fetch_row to pg_fetch_row
and so on.
No comments:
Post a Comment