Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Panel
borderStylesolid
titleTable of contents
Table of Contents
minLevel1
maxLevel3
includePagestrue
indent20px
styledisc

Homepage:

http://www.postgresql.org/Image Removed

Download:

http://www.postgresql.org/download/Image Removed

File(s):

postgresql-8.4.1-1-windows.exe (39 MB)

...

Per default PostgreSQL is running on port 5432.

Trusted connections for all users only from localhost

To allow trusted connections for all users only from localhost:

Windows:

Code Block
titleFile "D:PostgreSQLdatapg_hba.conf"
borderStylesolid

$ psql -U postgres -d template1 -c "GRANT ALL PRIVILEGES ON DATABASE pg_liferay to pg_liferay;"
GRANT
$

Restart the service ("Restart Server").

Usage

Windows:

  • You can connect to the database with the pgAdmin tool (Start - Programs - PostgreSQL 8.4 - pgAdmin III)
  • Use psql command shell.

Create a new user

Create an user with password for e.g. Liferay Portal usage:

Code Block
titleCreate new database user
borderStylesolid

$ psql -U postgres -c "CREATE USER pg_liferay WITH PASSWORD 'life1ray2' CREATEDB"
CREATE ROLE
$
...
# IPv4 local connections:
#host    all         all         127.0.0.1/32          md5
host    all         all         127.0.0.1/32          trust
...

Create a new database

Create e.g. database pg_liferay for Liferay Portal usage:

...

Code Block
titleGrant all permissions for a database to an user
borderStylesolid
$ psql -U postgres -d template1 -c "GRANT ALL PRIVILEGES ON DATABASE pg_liferay to pg_liferay;"
GRANT
$

Connect to a database

Code Block
titleConnect to a database
borderStylesolid
$ psql -d pg_liferay -U pg_liferay -W
...
pg_liferay=>

psql usage

Code Block
titlepsql usage
borderStylesolid

$ psql -d pg_liferay -U pg_liferay -W
Passwort für Benutzer pg_liferay:
psql (8.4.1)
Warnung: Konsolencodeseite (437) unterscheidet sich von der Windows-
         Codeseite (1252). 8-Bit-Zeichen funktionieren möglicherweise nicht
         richtig. Einzelheiten finden Sie auf der psql-Handbuchseite unter
         »Notes for Windows users«.
Geben Sie »help« für Hilfe ein.

pg_liferay=> help
Dies ist psql, die Kommandozeilenschnittstelle für PostgreSQL.
Geben Sie ein:  \copyright für Urheberrechtsinformationen
                \h für Hilfe über SQL-Anweisungen
                \? für Hilfe über interne Anweisungen
                \g oder Semikolon, um eine Anfrage auszuführen
                \q um zu beenden
pg_liferay=>
  • show all databases: pg_liferay=> \l
  • change database: pg_liferay=> \connect otherdatabasename
  • show all tables of a database: pg_liferay=> \dt
  • exit: pg_liferay=> \q