postgressnippets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
postgressnippets [2006/10/17 01:09] – old revision restored andi | postgressnippets [2006/11/13 16:13] (current) – old revision restored andi | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Postgres Snippet ====== | ||
+ | |||
+ | I'm a MySQL user so remembering the Postgres stuff is hard ;-) | ||
+ | |||
+ | ===== Enable Network Access ===== | ||
+ | |||
+ | In ''/ | ||
+ | |||
+ | host all | ||
+ | |||
+ | In ''/ | ||
+ | |||
+ | 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 < | ||
+ | |||
+ | ===== 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 >/ | ||
+ | |||
+ | ==== Create the database ==== | ||
+ | Create a new database with username and desired encoding. | ||
+ | | ||
+ | |||
+ | ==== Do the restore ==== | ||
+ | psql --username=< | ||