Skip to main content Help Control Panel

Rod Morison Software —  Technotes

Home «   R&D «   PostgreSQL «  

PostgreSQL 1A

I spent the last 8 years on a lot of MySQL and little MSSQL. Now, I'm on a PostgreSQL project. Here's my cheat sheet of DBMS specific commands I needed to figure out right away.
$ sudo apt-get install postgresql-8.3 postgresql-server-dev-8.3
$ sudo vi /etc/postgresql/8.3/main/postgresql.conf
# uncomment the listen_addresses = 'localhost' line
# optional: change localhost to machine hostaddr if you want outside access
$ sudo /etc/init.d/postgresql-8.3 restart
$ sudo -u postgres psql template1
template1=# ALTER USER postgres WITH UNENCRYPTED PASSWORD 'P8ss';
ALTER ROLE
template1=# CREATE USER user1 CREATEDB;
CREATE ROLE
template1=# ALTER USER user1 WITH UNENCRYPTED PASSWORD 'P9ss';
ALTER ROLE
template1=# CREATE DATABASE db1 WITH OWNER user1;
CREATE DATABASE
template1=# q
$ zcat /PathToDbDump/DbDump.sql.gz | psql -h localhost -U postgres -d user1
psql --username user1 --password -h localhost template1
CREATE DATABASE db2 WITH OWNER user1;


Stay tuned
recent comments
podcasted files
AddThis.com