Prev | Current Page 1141 | Next

Michael McCallister

"openSUSE Linux Unleashed"

The standard CREATE DATABASE SQL command is used to create new
databases:
postgres=# create database test;
CREATE DATABASE
postgres=# \c test
You are now connected to database ???test???.
test=#
After creating the database, use the \c meta-command to connect to it. You can create
database objects only while you are connected to the database.
User accounts in PostgreSQL are called Login Roles. The postgres superuser can create new
Login Roles and grant permissions to database objects to them. Remember though, the
openSUSE implementation of PostgreSQL uses the openSUSE system password files to
authenticate Login Roles, so your PostgreSQL Login Roles must match an existing
openSUSE user account:
test=# create role rich login password ???testing??™;
CREATE ROLE
test=# grant all on test to rich;
GRANT
test=#
Now you can log in to the test database using the system account rich:
rich@testing:~> psql test
Welcome to psql 8.1.5, 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
test=>
Implementing PostgreSQL 603
29
Because I was already logged into openSUSE as the user rich, all I needed to do was run
psql with the name of the database to connect to.


Pages:
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
Prince Lion Fundusze Emerytalne kebab kolokacja rack Okna PCV Wrocław