running postgresql

Started by Charlesover 18 years ago4 messagesgeneral
Jump to latest
#1Charles
post@upyours.us

I am running Gutsy (Ubuntu 7.10) and new to Postgresql. I followed the
direction at https://help.ubuntu.com/community/PostgreSQL. I executed
the following commands:
sudo -u postgres createuser -D -A -P myuser
sudo -u postgres createdb -O myuser mydb
dagon@DagonUX32:~$ psql mydb

and received the following error message:
psql: FATAL: role "dagon" does not exist.

Apparently Postgresql gets confused with my login name. Is this a
Postgresql problem or a Gutsy problem?

How do I establish a "role" that will let me setup different databases?

#2Scott Ribe
scott_ribe@killerbytes.com
In reply to: Charles (#1)
Re: running postgresql

Well it defaults to mapping to the current user, so you would have wanted:

psql -U myuser mydb

Or just create a postgres user named dagon and create the db as owned by
that user. Or su myuser before running psql...

--
Scott Ribe
scott_ribe@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice

#3Erik Jones
erik@myemma.com
In reply to: Charles (#1)
Re: running postgresql

On Nov 5, 2007, at 12:36 PM, Charles wrote:

I am running Gutsy (Ubuntu 7.10) and new to Postgresql. I followed the
direction at https://help.ubuntu.com/community/PostgreSQL. I executed
the following commands:
sudo -u postgres createuser -D -A -P myuser
sudo -u postgres createdb -O myuser mydb
dagon@DagonUX32:~$ psql mydb

and received the following error message:
psql: FATAL: role "dagon" does not exist.

Apparently Postgresql gets confused with my login name. Is this a
Postgresql problem or a Gutsy problem?

How do I establish a "role" that will let me setup different
databases?

Is the name of the db user you created really myuser? If so you need
to specify the user to connect as to psql, otherwise it defaults to
your current system username:

psql -U myuser mydb

Erik Jones

Software Developer | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Charles (#1)
Re: running postgresql

Charles <post@upyours.us> writes:

I am running Gutsy (Ubuntu 7.10) and new to Postgresql. I followed the
direction at https://help.ubuntu.com/community/PostgreSQL. I executed
the following commands:
sudo -u postgres createuser -D -A -P myuser
sudo -u postgres createdb -O myuser mydb
dagon@DagonUX32:~$ psql mydb

and received the following error message:
psql: FATAL: role "dagon" does not exist.

Apparently Postgresql gets confused with my login name.

There's no "confusion" about it: the default assumption for psql is that
your Postgres username is the same as your login name. What else would
you have expected it to use? If you want to use a different Postgres
username, you need to say so, eg

psql -U myuser mydb

You might still have problems with that, because on many systems the
default user authentication method disallows logging in under a username
different from your login name. I'm not sure if Ubuntu sets it up that
way, but if it does, you'd get something like "ident authorization
failed". You'll need to read the manual chapter about client
authentication if you want to choose a different behavior, such as
password-based authentication.

In any case, using Postgres username equal to your login name is going
to save you lots of typing, so I'd suggest doing it that way unless you
have a really good reason not to...

regards, tom lane