help me!!

Started by rxabout 23 years ago2 messageshackersdocsgeneral
Jump to latest
#1rx
rong.xie@stud.tu-muenchen.de
hackersdocsgeneral

Hello,

My name is rong xie. I am a Student at TU-Munich.
I have a question to Postgresql an Linux.
e.g:
for IBM DB2: I can write a test.sql file.

--test.sql
connect to database1;
set schema xie;
select * from table1;
insert table1 value('rong','xie',22);
select * from table1;
terminate;

Then I can execute the file "test.sql" in terminal.
db2 -tvf test.sql

In mysql: I can execute it so.
mysql > test.sql

How can I execute it in Postgresql?
is there similar command in linux for Postgresql?

Thank you very mach!

Best wish!

rong xie

#2Andres Ledesma
aledes@telefonica.net
In reply to: rx (#1)
hackersdocsgeneral
Re: [ADMIN] help me!!

hi rong...

well...is the postmaster running ?

there are a couple of postintallation steps ...

first, you must create and prepare the data files.
lets assume your pgSQL is installed on /usr/local/pgsql, right ?

1 . make dir where your data files are going to live, say data
root# mkdir /usr/local/pgsql/data

2 . lets make user postgres the owner of this dir
root# chown postgres /usr/local/pgsql/data

3 . let postgres init dababase on this dir
root# su postgres
postgres# /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

4 . start the postmaster..
set the environment var PGDATA=/usr/local/pgsql/data
postgres# /usr/local/pgsql/bin/postmaster -i

-i allows tcp connections to the db.

5 .start the client
postgres# /usr/local/pgsql/bin/psql

There is are various front end GUI's to postgres..one I use is pgAccess-- go to their page and lurk a bit ..

If you don't have the postgresql docs, you should take it on the postgresql.org site because there are a lot of options to postgresql be compiled with depending on further use you are going to do..to conect via Java, C++... and any way...printing this docs you'll find most of your answers faster. There are the admin, programmer, user...guides..and a small tutorial..

Good luck .. and best regards,

Andrew