Thread: Real novice question: Roles

Real novice question: Roles

From
Phil Dobbin
Date:
Hi.

I've just installed PostgreSQL 9.0.5 server & I can get the server running
by doing:

=========================================================================

$ sudo su
Password

sh-3.2# su postgres
bash-3.2$ whoami
_postgres

bash-3.2$ /opt/local/lib/postgresql90/bin/postgres -D\
> /opt/local/var/db/postgresql90/defaultdb
LOG:  database system was shut down at 2011-11-18 03:19:30 GMT
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

=========================================================================

`psql --help` tells me that I'm the default user (I'm the administrator of
the machine) but after Googling for hours I can't create a role or create a
database. I've followed the instructions in the PostgreSQL manual for this
version of pgsql to the letter but no go.

Any help appreciated.

Cheers,

    Phil.

--
Nothing to see here... move along, move along


Re: Real novice question: Roles

From
"Jean-Yves F. Barbier"
Date:
On Fri, 18 Nov 2011 15:07:59 +0000
Phil Dobbin <phildobbin@gmail.com> wrote:

> sh-3.2# su postgres

su - postgres

> bash-3.2$ whoami
> _postgres
>
> bash-3.2$ /opt/local/lib/postgresql90/bin/postgres -D\
> > /opt/local/var/db/postgresql90/defaultdb
> LOG:  database system was shut down at 2011-11-18 03:19:30 GMT
> LOG:  autovacuum launcher started
> LOG:  database system is ready to accept connections
>
> `psql --help` tells me that I'm the default user (I'm the administrator of
> the machine) but after Googling for hours I can't create a role or create a
> database. I've followed the instructions in the PostgreSQL manual for this
> version of pgsql to the letter but no go.

psql defaultdb         (seems to be defaultdb from what you wrote)
defaultdb=# CREATE USER myuser WITH PASSWORD 'icanconnect';

Or from the bash command line:
bash-3.2$ su - postgres
bash-3.2$ createuser myuser -W

--
X-rated movies are all alike ... the only thing they leave to the
imagination is the plot.

Re: Real novice question: Roles

From
Phil Dobbin
Date:
On 18/11/11 15:22, "Jean-Yves F. Barbier" <12ukwn@gmail.com> wrote:

[snip]

> Or from the bash command line:
> bash-3.2$ su - postgres
> bash-3.2$ createuser myuser -W

Thank you. After hours of searching, those two lines worked flawlessly. I'm
going to write them in nine-foot high characters on the InterWeb ;-).

Cheers,

    Phil.

--
Nothing to see here... move along, move along


Re: Real novice question: Roles

From
"Jean-Yves F. Barbier"
Date:
On Fri, 18 Nov 2011 15:54:36 +0000
Phil Dobbin <phildobbin@gmail.com> wrote:

> > Or from the bash command line:
> > bash-3.2$ su - postgres
> > bash-3.2$ createuser myuser -W
>
> Thank you. After hours of searching, those two lines worked flawlessly. I'm
> going to write them in nine-foot high characters on the InterWeb ;-).

I doubt that Phil, because what causes you a headache isn't usually forgotten
(this is THE reason why you'll sometimes get a RTFM: if somebody tells you
how to do it you'll forget it in the next hour:)

--
Obviously the only rational solution to your problem is suicide.

Re: Real novice question: Roles

From
Phil Dobbin
Date:
On 18/11/11 16:01, "Jean-Yves F. Barbier" <12ukwn@gmail.com> wrote:

> I doubt that Phil, because what causes you a headache isn't usually forgotten
> (this is THE reason why you'll sometimes get a RTFM: if somebody tells you
> how to do it you'll forget it in the next hour:)

Point taken but believe me this one I won't forget (it's already synced to
DropBox & SimpleNote ;-).

Cheers,

    Phil...

--
Nothing to see here... move along, move along


Re: Real novice question: Roles

From
"Daniel Staal"
Date:
On Fri, November 18, 2011 11:20 am, Phil Dobbin wrote:
> On 18/11/11 16:01, "Jean-Yves F. Barbier" <12ukwn@gmail.com> wrote:
>
>> I doubt that Phil, because what causes you a headache isn't usually
>> forgotten
>> (this is THE reason why you'll sometimes get a RTFM: if somebody tells
>> you
>> how to do it you'll forget it in the next hour:)
>
> Point taken but believe me this one I won't forget (it's already synced to
> DropBox & SimpleNote ;-).

And then there's the advance question: Can you tell someone why this
worked and why what you were doing before didn't?

(We don't need a reply.  But this is the difference between a copy-paste
scripter and a true admin.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


Re: Real novice question: Roles

From
Phil Dobbin
Date:
On 18/11/11 16:54, "Daniel Staal" <DStaal@usa.net> wrote:

> And then there's the advance question: Can you tell someone why this
> worked and why what you were doing before didn't?
>
> (We don't need a reply.  But this is the difference between a copy-paste
> scripter and a true admin.)

Whether a reply is warranted or not is the domain of the replyee ;-).

Coming from MySQL to PostgreSQL, I find the pgsql documentation somewhat
obfuscated. I needed to get in this one instance a working PostgreSQL
database running for a RoR project I'm doing (normally I'd use MySQL or
NoSQL) so I needed a quick & dirty way to get running in order to start
examining the documentation further.

Having achieved this with the help of Jean-Yves & others, I'm good to go.

Cheers,

    Phil...

--
Nothing to see here... move along, move along


Re: Real novice question: Roles

From
"Jean-Yves F. Barbier"
Date:
On Fri, 18 Nov 2011 17:45:58 +0000
Phil Dobbin <phildobbin@gmail.com> wrote:

> Whether a reply is warranted or not is the domain of the replyee ;-).

More a TYPE than a DOMAIN °<:p)

> Coming from MySQL to PostgreSQL, I find the pgsql documentation somewhat
> obfuscated.

Not really; this is because MySQL lacks many things (opposed to Pg AND SQL
standards), so you can think about it as the difference between a (very)
small car and a (very) large one: there are much more equipments in the
larger one, thus the manual is... larger.

You should begin reading docs with .../index.html, not .../bookindex.html

> I needed to get in this one instance a working PostgreSQL
> database running for a RoR project I'm doing (normally I'd use MySQL or
> NoSQL) so I needed a quick & dirty way to get running in order to start
> examining the documentation further.

This is a very risky way: DB SQL, Pg idiomatics and modelization are *really*
other worlds than regular programming (this is why both are usually separated
in projects, not for pleasure but by necessity).

While trying to get it fast'n'run you'll miss all the good things a real
RDBMS can bring to you.  In your case, the first one I see is learning
that large tables can't make it with a high load on the server (modelization).

Unfortunately this takes (long) time, but this time payback!
(I spent a whole year exclusively on PG and I'm far from knowing it 100%)

--
A professor is one who talks in someone else's sleep.

Re: Real novice question: Roles

From
Phil Dobbin
Date:
On 18/11/11 18:26, "Jean-Yves F. Barbier" <12ukwn@gmail.com> wrote:

>> Coming from MySQL to PostgreSQL, I find the pgsql documentation somewhat
>> obfuscated.
>
> Not really; this is because MySQL lacks many things (opposed to Pg AND SQL
> standards), so you can think about it as the difference between a (very)
> small car and a (very) large one: there are much more equipments in the
> larger one, thus the manual is... larger.
>
> You should begin reading docs with .../index.html, not .../bookindex.html

From the knowledge I've garnered over the years reading about PostgreSQL
I've always thought of it as in the upper league of RDBS capable of
supplying very large instances of support to major frameworks. That said, on
a computer, I hadn't clapped eyes on its methods 'til about 22:30 UTC last
night. With a working instance of pgsql now running on my Macbook Pro I can
now attempt to RTFM from the prologue onwards.

>> I needed to get in this one instance a working PostgreSQL
>> database running for a RoR project I'm doing (normally I'd use MySQL or
>> NoSQL) so I needed a quick & dirty way to get running in order to start
>> examining the documentation further.
>
> This is a very risky way: DB SQL, Pg idiomatics and modelization are *really*
> other worlds than regular programming (this is why both are usually separated
> in projects, not for pleasure but by necessity).

> While trying to get it fast'n'run you'll miss all the good things a real
> RDBMS can bring to you.  In your case, the first one I see is learning
> that large tables can't make it with a high load on the server (modelization).

> Unfortunately this takes (long) time, but this time payback!
> (I spent a whole year exclusively on PG and I'm far from knowing it 100%)

Thanks for all your help & advice. It is much appreciated.

Cheers,

    Phil...

--
Nothing to see here... move along, move along