Postgresql quickstart guide

Installation

Gentoo

First, check your USE flags.

Then :

# emerge postgresql

Addd a password :

# passwd postgres

and finish the install :

emerge --config =postgresql-8.1.8

Debian

Install the package :

apt-get install postgresql-8.1

Change the new postgres user password with passwd command, as root.

Start the database daemon :

# /etc/init.d/postgresql-8.1 start

At the moment, only the postgres user can log in the database server. To be able to use your own unix account, you have to had it :

stan@hermes:~/djangoprojects/portageproject$ su postgres
Password:
postgres@hermes:/home/stan/djangoprojects/portageproject$ createuser stan
Shall the new role be a superuser? (y/n) y
CREATE ROLE
postgres@hermes:/home/stan/djangoprojects/portageproject$ exit
exit

Now you can create your own database :

stan@hermes:~/djangoprojects/portageproject$ createdb portage
CREATE DATABASE
stan@hermes:~/djangoprojects/portageproject$  

To use the client and connect to the new database :


Password:
Welcome to psql 8.1.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

portage=#         

Running the server

As root :

/etc/init.d/postgresql start

Create a first database

Actually, there is only one user, postgres, so :

stan@hermes ~/Bommings/bommings-dev $ createdb -U postgres -W myfirstprojectdb
Mot de passe : 
CREATE DATABASE
stan@hermes ~/Bommings/bommings-dev $ 

Manage user account

TODO

Interactive shell

To connect to a database djangodb :

stan@hermes ~/django/mysite $ psql -U postgres -W djangodb
Mot de passe pour l'utilisateur postgres : 
Bienvenue dans psql 8.1.8, l'interface interactive de PostgreSQL.

Tapez:  \copyright pour les termes de distribution
        \h pour l'aide-mémoire sur les commandes SQL
        \? pour l'aide-mémoire sur les commandes psql
        \g ou terminez avec un point-virgule pour exécuter une requête
        \q pour quitter

djangodb=# 

getting started

First we have to create account for normal user

References

 
gnu/postgres_en.txt · Dernière modification: 2007/05/26 09:08 par stan
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki