Jun 20, 2011

PostgreSQL

#dump 
# http://stackoverflow.com/questions/2893954/how-to-pass-in-password-to-pg-dump
pg_dump -U db_user db_name | gzip > dump.sql.gz
gunzip dump.sql.gz
psql -U db_user db_name -f -  < dump.sql

#create
#grant usage on *.* to uuuu@localhost identified by 'pppp';
grant all privileges on database DB_NAME to USER_NAME;

#priveleges
sudo vi /etc/postgresql/8.4/main/pg_hba.conf

local   all         postgres                          trust

#Show all tables
\dt
# create user
createuser -U postgres -P -S -D -R -e username

# create db
createdb -U postgres -E UTF8 -T template0 -e -O username database_name

No comments: