What is the DATABASE_URL in Postgres


When getting started on Heroku with Node.js here, You will have a new database in  Postgres.


        heroku config

and here is what you have:

DATABASE_URL: postgres://tpkhetigbqignwgqid:2d866e51149688dbfd15eafa2f3aae18f81697418e7a73e72625a1ac21c008a4@ec2-54-225-227-125.compute-1.amazonaws.com:5432/dftroisg8ps8r9

So, what is the database url mean? Hmm, it is a combination of username,password, host and database name

here is the syntax:

var conString = "postgres://UserName:Password@Host:5432/Database";

It means:

UserName = tpkhetigbqignwgqid
Password = 2d866e51149688dbfd15eafa2f3aae18f81697418e7a73e72625a1ac21c008a4
Host = ec2-54-225-227-125.compute-1.amazonaws.com
Database = dftroisg8ps8r9

And here is how you connect it to your pgAdmin:



Congratulation, you have successful to connect to the first Postgres database ever.