Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I have installed PostgreSQL and MySQL how to use it
Message
 
À
24/10/2001 14:11:35
Information générale
Forum:
Linux
Catégorie:
Problèmes base de données et Admin
Divers
Thread ID:
00572796
Message ID:
00572827
Vues:
27
>I have installed PostgreSQL and MySQL.
>The Postgre is started at bootup and when I try to reinsall the rpm of mysql-4 it says it is insalled.
>Is there any program where I can test them by running interactive SQL command.
>What are the default password for them.
>Rajesh

From the commandline you can run psql. From KDE or GNOME you can run pgaccess.
> psql template1
Then
createdb
The command createdb gives you other options, but if you do not specify a template db it will use the default 'template1'.
Then you can start it directly using
psql

As admin, possibly postgres, you will have to add yourself as a user and give yourself admin permission to add databases and users. Then you can use template1 to create a new database. Once you have added your own database and logged in as a user you can create your own tables, etc... The PostgreSQL tutorial includes working with a tutorial database that contains contains weather data, which is installed by running an sql script. The tutorial covers all of this very clearly. For playing around I prefer working with pgaccess because it is a TCL frontend that included tables, queries, forms, reports, etc., and other stuff.
Writing your own front end for specific solutions using Kylix and Zeos components would be, IMO, the prefered route.

Postgres database passwords are separate from any operating system user passwords. Ordinarily, the password for each database user is stored in the pg_shadow system catalog table. Passwords can be managed with the query language commands CREATE USER and ALTER USER, e.g., CREATE USER foo WITH PASSWORD 'secret';. By default, that is, if no password has been set up, the stored password is NULL and password authentication will always fail for that user.

Once you have constructed a database, you can access it by:
running the Postgres terminal monitor program (psql) which allows you to interactively enter, edit, and execute SQL commands.
It can be activated for the dbname database by typing the command:
psql yourdbname
You will be greeted with the following message:
Welcome to psql, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

yourdbname=>

This prompt indicates that the terminal monitor is listening to you and that you can type SQL queries into a workspace maintained by the terminal monitor. The psql program responds to escape codes that begin with the backslash character, "\". For example, you can get help on the syntax of various Postgres SQL commands by typing:

yourdbname=> \h

If you enter
yourdbname=> \i /src/tutorial/basics.sql
it will execute that script file and generate some tutorial tables.

Here is an example of the main table in the tutorial:
CREATE TABLE weather (
city varchar(80),
temp_lo int, -- low temperature
temp_hi int, -- high temperature
prcp real, -- precipitation
date date
);
Here is where the query and the meat of the tutorial start:
http://www.us.postgresql.org/users-lounge/docs/7.1/tutorial/query.html

Also see:
http://www.us.postgresql.org/users-lounge/docs/7.1/admin/creating-cluster.html
http://www.us.postgresql.org/users-lounge/docs/7.1/admin/user-manag.html

Here is the front page of the tutorial:
http://www.us.postgresql.org/users-lounge/docs/7.1/tutorial/

Have fun!
JLK
Nebraska Dept of Revenue
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform