Databases

In the object hierarchy under any cluster, you will find Databases. You can create, comment on, and drop a database. In this example, you will create a database named web_store.

  1. A database is an object under a cluster, so to create a database, first expand the cluster under which you wish to create the database (click the + beside the cluster name).

  2. Right-click on Databases and select CREATE DATABASE.

  3. The first field is the name for the database. Type: web_store

  4. Optionally, set the Location. The default location is that specified by the environment variable PGDATA, but you can specify another previously initialized location.

    Note

    The standard installation does not allow absolute paths to be used as locations, only environment variables known to the database backend. You must recompile the backend to allow the use of absolute paths.

  5. Optionally, set the Template. The default template used is template1; however, you can specify any other existing database in the cluster to be used as the template for the new database.

  6. Optionally, set the Encoding. The default encoding is SQL_ASCII; however, you can view the available encodings by clicking on the drop down list.

  7. Click OK to create the database.

RHDB Administrator also enables you to perform the following operations on an existing database:

Dropping

To drop a database, right-click on it and select DROP DATABASE. If View -> Ask For Confirmations is enabled, you are asked to confirm that you want the database dropped; if it is disabled, the database is dropped immediately. This action cannot be undone.

Commenting

PostgreSQL allows commenting on databases, which makes them easier to identify. To comment on a database, right-click on it and select COMMENT. A dialog asks for the comment. If there is already a comment on the database, this comment is displayed. Type the new comment in the edit box and click OK (or press [Enter]) to save the new comment.

Refer to the Red Hat Database Administrator and User's Guide for more information on database locations, templates, and encodings.