Setting up PostgreSQL



PostgreSQL comes preinstalled on every Cloud9 workspace, yay! :tada: Here are a few basic commands to help out. The sudo sudo in each command is not a typo, you need to enter this or it will prompt for your ubuntu user password and break.

Start the PostgreSQL service

sudo service postgresql start

Connect to the service


Create a PostgreSQL database

Make sure you have logged into the PostgreSQL terminal and then you can just run:

postgres=# CREATE DATABASE "groceries";

List all databases

postgres=# \list

Connecting with your language of choice

First you must set a password for your postgres user.

postgres-# \password postgres
Enter new password: 

Then you can connect with username “ubuntu” and the password you set. Here’s an example in PHP:

$link = pg_connect("host=localhost dbname=groceries user=ubuntu password=cloud9isawesome");


Setting Up phpPgAdmin
Problems with postgreSQL in ruby
Postgresql: is there a pre-set database cluster? Do I need initdb?
Can't connect to Phppgadmin
Trouble connecting Postgresql to Rails
PostgreSQL and node
Tutorials - Table of Contents
PostgreSQL & Django
Help setting up postgresql
Migrate existing Rails project from SQLite3 to PostgreSQL for Heroku production

A post was split to a new topic: Start Postgres automatically


in what port is PostgreSQL running? Thanks.


How am I able to connect node.js to PostgreSQL in cloud9. Am I to make a change in the IP as I did with mongoDB?
I am able to run the same package with PostgreSQL outside of cloud9, so I don’t believe it is a config issue.

[HPM] Proxy created: /api -> http://localhost:3000
Frontend located at http://localhost:8080/
throw er; // Unhandled ‘error’ event

Error: listen EADDRINUSE
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort (util.js:930:20)
at Server._listen2 (net.js:1250:14)
at listen (net.js:1286:10)
at net.js:1395:9
at nextTickCallbackWith3Args (node.js:453:9)
at process._tickDomainCallback (node.js:400:17)


Isn’t there a way to run this automatically everytime system is started.


I’m trying to set up postgeSQL on AWS Cloud9, but I’m running into an error when starting the service:

postgresql: unrecognized service

Did something change from the time of the post to now on how to start the service?


Did someone get “postgresql: unrecognized service” fixed?


Hi I am also experiencing the “postgresql: unrecognized service” issue on AWS Cloud 9.

I tried to follow the following instructions but without success:


Has anyone figured out a solution to this?


In case anyone has the same problem as me in the future, it was just a simple service name issue.

I used the following command to find out what the postgres service is called:
ls /etc/init.d | grep postgres
Then executed:
sudo service <service_name> start