Skip to content

statianzo/sql-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

PostgreSQL Setup

Heroku

Heroku is a service that offers simple web application hosting with many extra features. We'll use their hosted Postgres service to quickly create a database instance.

https://www.heroku.com

Sign up

On the Heroku website, click the Sign up for free button. After submitting your details you'll be sent a confirmation email. Follow the link found in this email and set your password.

Heroku Home Page Sign Up
Heroku Homepage Heroku Signup

Create an App

On your first visit to the dashboard, click the Create New App button. From there, specify a name (or leave blank and Heroku will generate a name). Click Create App

Create New App Add a Name
Heroku Create App Heroku Add Name

Provision the Heroku Postgres add-on

At this point, you're in the dashboard for the project you just created. Depending on the size of your browser window, you will see either a "Resources" tab or a set of seven icons near the top of the window. Select the resources tab if you see text options. If you see icons, select the icon with three horizontal lines.

Select the "Resources" Tab Or the Resources Icon
Heroku Resources Tab Heroku Resources Icon

On the next screen, type "postgres" in the "Add-ons" search field and select "Heroku Postgres" from the list. Provision the Hobby Dev free tier database.

Select Heroku Postgres Click Provision
Heroku Search For Addon Heroku Povision Database

View database credentials

Select the Heroku Postgres :: Database add-on from the list. On the database page, click the View Credentials button. You will be presented with the credentials necessary to connect to the Postgres instance.

Heroku Postgres :: Database View Credentials Credentials for Connecting
Heroku Go To Postgres Heroku Postgres Dashboard Heroku Postgres Credentials

Way to go! You have your very own Postgres database. Now, you need a client to connect and run queries against it.

SQL Tabs

SQL Tabs is a cross-platform database client that will allow you to execute SQL commands to your hosted Postgres database.

Install

Download the version for your OS from http://www.sqltabs.com and install accordingly

  • Mac: unzip the download and put it in your Applications. Double click. If you get a security warning, open System Preferences > Security and click Open Anyway
  • Windows: unzip the download and place the folder somewhere easy to access, like your desktop. Run sqltabs.exe.
  • Linux: gunzip the tarball and execute ./sqltabs
SQL Tabs Download Mac Warning Mac Preferences
SQL Tabs Download SQL Tabs Download SQL Tabs Security

Connect to Postgres

Copy the URI from your Heroku Postgres credentials. Paste it into the connection string input at the top of SQL Tabs and THIS IS IMPORTANT: append ?ssl=true to the end.

SQL Tabs URI

Test

Run a select 'Hello World'; query against the database to ensure you're connected. Execute the query using ⌘-R or Ctrl-R. If the database responds with a column that contains 'hello world', you're good to go.

SQL Tabs Hello World

Finished

Congratulations! You've successfully set up a hosted Postgres database on Heroku. You can now connect to this database using SQL Tabs and write database queries to create and update content on your hosted database. Have fun!

About

Setting up a Postgresql instance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published