====== Postgres Snippet ====== I'm a MySQL user so remembering the Postgres stuff is hard ;-) ===== Enable Network Access ===== In ''/etc/postgresql/8.1/main/pg_hba.conf'' add: host all all 192.168.1.0/24 md5 In ''/etc/postgresql/8.1/main/postgresql.conf'' add: listen_addresses = '*' Then restart postgres. ===== Create new User and DB ===== $> sudo -u postgres createuser $> sudo -u postgres createdb --owner ===== Add password for user ===== $> sudo -u postgres psql ALTER USER WITH PASSWORD ''; ===== Database Backup ===== Useful to make a fresh database install on another machine. ==== Do the backup ==== Create a backup of astj_dev_0 that we will call astj_dev_0.bak pg_dump -U postgres astj_dev_0 >/tmp/astj_dev_0.bak ==== Create the database ==== Create a new database with username and desired encoding. createdb --username= --encoding=latin1 ==== Do the restore ==== psql --username= -d