Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to login as a postgresql user ?

Status
Not open for further replies.

dhossbach

Technical User
Apr 16, 2002
13
0
0
FR
Initdb -> worked ok
postmaster -> starts with no error messages

When trying to create a database with createdb, the following message is displayed :
psql: FATAL 1: user "bioforme" does not exist

After reading some documentation, it seems that I have to be loged in as a prostgres user.
How is this to be done ?
(I tried to leave KDE and login with "prostgres" as username and "prostgres" as password but it did not work, I also tried to put my user name in the postgres user groupe with no result)

This is probably very basic, but not easy to find.

Thanks in advance for any help.

Note : OS is mandrake 8.1
 
Well, I'm sure this is just a small mistake on your part, but "prostgres" is not the default username. It is "postgres".

In a default install of PostgreSQL, the "owner" of postgreSQL is usually the user called postgres. However, this is not necessarily the case, so I would have to see exactly how Mandrake handles it.

Try running "top" or "ps -ax" from a terminal window, and see if it shows "postgres" as the owner of the postgres process. The line in question should look something like
Code:
  280 postgres        2   0  5348K   856K select   0:16  0.00%  0.00% postgres
(From top), or:
Code:
  280 con- I      0:16.01 /usr/local/bin/postmaster -D /usr/local/pgsql/data -i (postgres)
(From ps -ax)

However, if you didn't already have a user called "postgres" on your machine, then what user is the postgres process (from postmaster) running under? The basic idea here is that the postgres process runs under a certain username (not root), and points to s certain data directory with the keyword "-D /directory/path". The username running the process is the user that can log into postgreSQL and control it completely. Inside postgreSQL, that user can create many sub-users who con connect to this or that database. All postgreSQL users must be valid users on the Linux system in general. -------------------------------------------

"Now, this might cause some discomfort..."
(
 
Thanks for your help.

So far it has been possible to login as "su - postgres".
Database could be created and pgaccess is runnig fine.
Creating new users was also possble.

"ps -ax" has allowed me to see that the default data directory is /var/lib/pgsql/data in mandrake 8.1.

Importing data from a text file did not work:
<copy &quot;database&quot; from &quot;database.txt&quot; delimters &quot;;&quot;>
returned no errors but database remains empty.
Strange . . .




Detlef Hossbach
(occasional programmer)
 
PostgreSQL database users don't have to be users in the Linux system itself. They're separate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top