sudo -u postgres psql -> postgres=#
CREATE DATABASE test_database;
CREATE USER test_user WITH password 'qwerty';
GRANT ALL privileges ON DATABASE test_database TO test_user;
ALTER USER test_user CREATEDB;
DROP ROLE test_user;
psql -h localhost test_database test_user
\?, \h - available psql commands
\d users, \du, \dg - List of roles - description of the 'users' table
\d, \dt - all tables
\list - all DBs
rails new myapp --database=postgresqlsudo -u postgres psqlcreate role alabama_song with createdb login password '1';sudo gvim /etc/postgresql/X.Y/main/pg_hba.conf- view config filesudo service postgresql restart
log in with psql sudo -u postgres psql
connect to DB \connect wiztr-dev
list indexes \di
list relations \d - tables, sequences, ...