Note: Open PostGreSQL in command line and do some stuffs

To access postgres console:

$ sudo -u postgres -i

postgres@host:~$ psql

or

$ sudo -u postgres psql

[sudo] password for john: 
psql (9.3.12)
Type "help" for help.

postgres=# 

 

# For help
postgres=# help
 You are using psql, the command-line interface to PostgreSQL.
Type: \copyright for distribution terms
 \h for help with SQL commands
 \? for help with psql commands
 \g or terminate with semicolon to execute query
 \q to quit
# For help
postgres=# \h
 Available help:
 ABORT CLUSTER DEALLOCATE END
 ALTER AGGREGATE COMMENT DECLARE EXECUTE
 ALTER COLLATION COMMIT DELETE EXPLAIN

Create database

# database command has to end with semicolon
postgres=# create database july_prod_dump1;
CREATE DATABASE

Alter permission

ALTER USER new_user CREATEDB

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s