PostgreSQL

Loris Tissino

6 dicembre 2009

Introduzione

Quelle che seguono sono solo brevi note su cose che si possono fare e potrebbero non essere del tutto ovvie.

Impostazione della password

$ sudo -u postgres psql template1
Welcome to psql 8.3.8, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

template1=# ALTER USER postgres WITH PASSWORD 'myseKret';
ALTER ROLE
template1=# \q

e poi

$ sudo passwd postgres
New UNIX password: 
Retype new UNIX password: 
passwd: password aggiornata correttamente

Avvio del server

$ sudo service postgresql-8.3 start
 * Starting PostgreSQL 8.3 database server                               [ OK ] 

Creazione di un utente e di un database

 sudo -u postgres createuser -D -A -P mynewuser
 # (-A non รจ documentato, ma evita che venga chiesto
 # "Shall the new role be a superuser? (y/n) n"

 sudo -u postgres createdb -O mynewuser mydatabase