Panel |
---|
borderStyle | solid |
---|
title | Table of contents |
---|
|
Table of Contents |
---|
minLevel | 1 |
---|
maxLevel | 3 |
---|
includePages | true |
---|
indent | 20px |
---|
style | disc |
---|
|
|
Installation
Windows:
- Execute the one-click installer "postgresql-8.4.1-1-windows.exe"
- Install it to a suitable directory, e.g. "C:\Program Files\PostgreSQL\8.4"
- Select a suitable data directory, e.g. "D:\PostgreSQL\data"
- Enter a password for admin account "postgres"
Configuration
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 |
---|
title | File "D:PostgreSQLdatapg_hba.conf" |
---|
borderStyle | solid |
---|
|
$ 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 |
---|
title | Create new database user |
---|
borderStyle | solid |
---|
|
...
# 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 |
---|
title | Create new database |
---|
borderStyle | solid |
---|
|
$ psql -U postgres -d template1 -c "CREATE DATABASE pg_liferay ENCODING='UNICODE';"
CREATE DATABASE
$
|
Grant all permissions for a database to an user
Code Block |
---|
title | Grant all permissions for a database to an user |
---|
borderStyle | solid |
---|
|
$ psql -U postgres -d template1 -c "GRANT ALL PRIVILEGES ON DATABASE pg_liferay to pg_liferay;"
GRANT
$
|
Connect to a database
Code Block |
---|
title | Connect to a database |
---|
borderStyle | solid |
---|
|
$ psql -d pg_liferay -U pg_liferay -W
...
pg_liferay=>
|
psql usage
Code Block |
---|
title | psql usage |
---|
borderStyle | solid |
---|
|
$ 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