How to set up a free PostgreSQL database on Heroku
@codewithdulan

How to set up a free PostgreSQL database on Heroku

Heroku?offers a free plan for hosting PostgreSQL databases. This can be handy if you’re getting started with a new project or “just quickly need a hosted database” for experimentation or prototyping.

This guide explains how to quickly setup a free PostgreSQL database on Heroku. You can learn more in the?Heroku Postgres documentation.

In order to create a new database on Heroku, you first need to create an?app?in your personal dashboard. Then you can attach a?Heroku Postgres?instance to it as a?resource.

  1. Login to Heroku?dashboard?and Create app

No alt text provided for this image

2. Go to?Resources → Add-ons →?Find more add-ons?. Add?Heroku Postgres?add-on to Heroku app

No alt text provided for this image

3. Click on?Install Heroku Postgres

No alt text provided for this image

4. Then select the app which want to install?Heroku Postgres?add-on. And click on?Submit Order Form

No alt text provided for this image
No alt text provided for this image

Now you successfully added?Heroku Postgres?add-on to your app.

No alt text provided for this image

5. To Get Database credentials, Click on?Heroku Postgres?add-on. Then go-to?Settings → View Credentials…

No alt text provided for this image

You can use these credentials to connect to your PostgreSQL database from any PostgreSQL client, e.g. psql (CLI), TablePlus, Postico (GUIs) and pgAdmin.

6. Connect to postgreSQL db using pgAdmin

  • Firstly create a server group for register our server.

No alt text provided for this image

  • Then right click on server group and goto Register --> Server.

No alt text provided for this image

  • Then give above details in Heroku postgreSQL DB to register the server with pgAdmin4. (We can get these details in Step 5)

Name for Server
Host name/ Address
Port
Maintenance database
Username
Password        
No alt text provided for this image
No alt text provided for this image

  • Now you can access your database using pgAdmin

No alt text provided for this image

Please note that, there will be more databases in the server which we have connect with pgAdmin. Therefore please find your correct database. (Database names are ordered by alphabetically.)

For further reading, you can check out the?Heroku Posgres documentation.

If you want to use this database in a Node.js or TypeScript application, be sure to check out?Prisma?as an alternative to traditional ORMs.

now it's not free..

回复
Chandima Herath

A Team Player | Software Engineer | Citizen Scientist

2 年

Good job..!

要查看或添加评论,请登录

Dulan Lokunarangodage的更多文章

社区洞察

其他会员也浏览了