LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 11-21-2006, 11:23 PM   #1
thinker
LQ Newbie
 
Registered: Apr 2006
Posts: 11

Rep: Reputation: 0
PostgreSQL


I installed Postgrsql v 8.1 on my RH 9.

installation is complete. but when I run

# /usr/local/pgsql/bin/psql

It give me error " psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?


Anyone have idea whats going wrong .. please.

Waiting your reply,


Thank you
 
Old 11-22-2006, 12:31 AM   #2
Galaxy_Stranger
Member
 
Registered: Oct 2003
Distribution: CentOS 6 and Fedora
Posts: 252

Rep: Reputation: 36
Yeah - that's a good question. I've had a similar problem. I think it's because we don't fully understand how the psql server works.
 
Old 11-22-2006, 10:07 PM   #3
thinker
LQ Newbie
 
Registered: Apr 2006
Posts: 11

Original Poster
Rep: Reputation: 0
I did bit study for it.
and now I am stuck the folow point.
" /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
LOG: database system was shut down at 2006-11-24 07:55:18 GST
LOG: checkpoint record is at 0/33A70C
LOG: redo record is at 0/33A70C; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 565; next OID: 10794
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready
LOG: transaction ID wrap limit is 2147484146, limited by database "postgres"
FATAL: database "shakir" does not exist
FATAL: database "shakir" does not exist
"

Anyone know what the reason and how to make shakir as user for that database. ?

Last edited by thinker; 11-22-2006 at 10:10 PM.
 
Old 12-04-2006, 03:27 PM   #4
MarkMapo
LQ Newbie
 
Registered: Dec 2006
Posts: 2

Rep: Reputation: 0
Postgresql problems

For Thinker and Galaxy_Stranger...
When you see the error 'psql: could not connect to server', you probably don't have your environment variables set. Specifically PGDATA. Check the postgresql site for install instructions about these (If you ran initdb, set PGDATA to what you had set during that time. If you didn'r run initdb, you need to do that).

Then for Thinker alone...
when you get the error 'database "shakir" does not exist', then you are probably user shakir, and the default database that psql will connect to is the database that is the same as the user name. So add a database name at the end of the psql command (like this...)
psql -U shakir template1
or just
psql template1
if you are already user shakir.

You can also create a database using..
createdb shakir

Go the the postgresql website - they have great docs, and all your questions will be answered if you search for what ails you.
 
Old 12-04-2006, 04:11 PM   #5
buskmann
LQ Newbie
 
Registered: Mar 2005
Location: Norway
Distribution: FC5
Posts: 27

Rep: Reputation: 16
Are all PostgreSQL users allowed to connect to all databases? I do this to create a new user/database.

Creating database (as user postgres):
Code:
bash-3.00$ createdb testbase;
could not change directory to "/root"
CREATE DATABASE
Creating user (as user postgres):
Code:
-bash-3.00$ createuser mann
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
Logging in:
Code:
psql -h 127.0.0.1 -U mann testbase
Welcome to psql 8.0.8, the PostgreSQL interactive terminal.
... creating tables etc. ...
How is access to a database restricted?
 
Old 12-05-2006, 01:33 PM   #6
MarkMapo
LQ Newbie
 
Registered: Dec 2006
Posts: 2

Rep: Reputation: 0
postgresql database restrictions

I hate to tell ya this buskmann, but there isn't a way to set a restriction for an entire database (some grumbling in the postgresql community because of this). You can however, set all sorts of restrictions on tables, which is the traditional role of a dba.

I have all sorts of scripts that create databases and their table. When creating a table, I define all of the specifics for the table (fields, default values, relations, etc), then right after the table definition, I assign all the permissions (using grant and revoke). 'course I have already defined users and groups before creating the tables, so its easy for me to have a bunch of statements like..
GRANT DELETE ON table1 TO GROUP sub_admins;
REVOKE DELETE ON table1 FROM PUBLIC;
GRANT SELECT ON table1 TO PUBLIC;
REVOKE UPDATE ON table1 FROM PUBLIC;
GRANT UPDATE ON table1 TO GROUP sub_admins;

This gives very specific behavior for each user and group to each table. I generally allow everyone to select from a table, updates to a subset, inserts and deletes on a smaller subset.

I know it sounds like a pain, but from a dba point of view it is very useful. Then, once I've created my scripts to create all this (call it version 1.0) and I want to change my permissions, then I copy the scripts and create version 1.1. and I also create a script update1.0to1.1, which is the changes between the two. All of this is source controlled so at any time I can create a version 1.0 or 1.1. I can also update any system on the fly to 1.1 with my scripts (I don't bother with going back, 'cause you can always make version 1.2!)

Also, just so you know, you don't need the '-h 127.0.0.1' flag with psql (127.0.0.1 is just a loopback). You also don't need '-U mann' flag if you are user mann (psql knows to use your username as the database user). This is only useful if you want to connect to the database as a user other than who you are.
 
Old 12-05-2006, 02:06 PM   #7
buskmann
LQ Newbie
 
Registered: Mar 2005
Location: Norway
Distribution: FC5
Posts: 27

Rep: Reputation: 16
Thanks, that explains it. Administration of PostgreSQL is a bit different than MySQL, but I guess it's just a matter of habits.
 
Old 12-05-2006, 03:39 PM   #8
Galaxy_Stranger
Member
 
Registered: Oct 2003
Distribution: CentOS 6 and Fedora
Posts: 252

Rep: Reputation: 36
Thanks Mark - I'll bang on it until I get it to work.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PostgreSql sijomon_nd Fedora 1 09-27-2005 09:27 PM
need help in postgresql yawhum80 Linux - Newbie 0 10-28-2003 10:03 AM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM
postgreSQL dsgdevil Linux - Software 3 02-20-2003 10:30 PM
PostgreSQL dorian33 Linux - Software 3 01-15-2003 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration