Getting started with first user.

Started by Agnar Renolenabout 8 years ago6 messagesgeneral
Jump to latest
#1Agnar Renolen
agnar.renolen@gmail.com

I have just installed PostGIS (Postgres9.6) on a Debian server using
apt-get.

But I have problems doing anything:

I installed as root, but trying doing things as my local user "me"

me> createuser me
createuser: could not connect to database postgres: FATAL: role "me" does
not exist

Then, trying the same as root, but gettinge the same result.

root> createuser me
createuser: could not connect to database postgres: FATAL: role "root" does
not exist

Then trying with the -U postgres option.

root> createuser -U postgres me
createuser: could not connect to database postgres: FATAL: Peer
authentication failed for user "postgres"

How do I get started?

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Agnar Renolen (#1)
Re: Getting started with first user.

On 01/09/2018 01:48 AM, Agnar Renolen wrote:

I have just installed PostGIS (Postgres9.6) on a Debian server using
apt-get.

But I have problems doing anything:

I installed as root, but trying doing things as my local user "me"

me> createuser me
createuser: could not connect to database postgres: FATAL: role "me"
does not exist

Then, trying the same as root, but gettinge the same result.

root> createuser me
createuser: could not connect to database postgres: FATAL: role "root"
does not exist

Then trying with the -U postgres option.

root> createuser -U postgres me
createuser: could not connect to database postgres: FATAL: Peer
authentication failed for user "postgres"

How do I get started?

https://wiki.debian.org/PostgreSql#User_access

--
Adrian Klaver
adrian.klaver@aklaver.com

#3Jaime Soler
jaime.soler@gmail.com
In reply to: Agnar Renolen (#1)
Re: Getting started with first user.

please try su postgres -c 'createuser -U postgres me' or change auth method
in your pg_hba.conf

2018-01-09 10:48 GMT+01:00 Agnar Renolen <agnar.renolen@gmail.com>:

Show quoted text

I have just installed PostGIS (Postgres9.6) on a Debian server using
apt-get.

But I have problems doing anything:

I installed as root, but trying doing things as my local user "me"

me> createuser me
createuser: could not connect to database postgres: FATAL: role "me" does
not exist

Then, trying the same as root, but gettinge the same result.

root> createuser me
createuser: could not connect to database postgres: FATAL: role "root"
does not exist

Then trying with the -U postgres option.

root> createuser -U postgres me
createuser: could not connect to database postgres: FATAL: Peer
authentication failed for user "postgres"

How do I get started?

#4John McKown
john.archie.mckown@gmail.com
In reply to: Agnar Renolen (#1)
Re: Getting started with first user.

On Tue, Jan 9, 2018 at 3:48 AM, Agnar Renolen <agnar.renolen@gmail.com>
wrote:

I have just installed PostGIS (Postgres9.6) on a Debian server using
apt-get.

But I have problems doing anything:

I installed as root, but trying doing things as my local user "me"

me> createuser me
createuser: could not connect to database postgres: FATAL: role "me" does
not exist

Then, trying the same as root, but gettinge the same result.

root> createuser me
createuser: could not connect to database postgres: FATAL: role "root"
does not exist

Then trying with the -U postgres option.

root> createuser -U postgres me
createuser: could not connect to database postgres: FATAL: Peer
authentication failed for user "postgres"

How do I get started?

​It's been a long time for me, but as I recall, I did something like:

me$ sudo su - # change to root
root# su - postgres # change to postgres user
postgres$​ createuser -s me #create "me"
postgres$ exit # go back to root
root# exit # go back to me
me$ createdb me # create my default database

In /var/lib/pgsql/data/pg_hba.conf , I have lines like:

# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust

--
I have a theory that it's impossible to prove anything, but I can't prove
it.

Maranatha! <><
John McKown

In reply to: Agnar Renolen (#1)
Re: Getting started with first user.

On 09/01/18 09:48, Agnar Renolen wrote:

Then trying with the -U postgres option.

root> createuser -U postgres me
createuser: could not connect to database postgres: FATAL: Peer
authentication failed for user "postgres"

You need to specify the host as well, to force a TCP/IP connection:

createuser -U postgres -h localhost me

The default pg_hba.conf on Debian uses a Unix socket and peer
authentication, hence the error you're seeing.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

#6Agnar Renolen
agnar.renolen@gmail.com
In reply to: Adrian Klaver (#2)
Re: Getting started with first user.

Found out a way out.

Logged in as *root*, and created a password for the *postgres* user.

Then logged in as *postgres* and and ran "createuser -s me".

Then logging in as *me*, ran "createdb"

Agnar

Show quoted text

On 09/01/2018 17:13, Adrian Klaver wrote:

On 01/09/2018 01:48 AM, Agnar Renolen wrote:

I have just installed PostGIS (Postgres9.6) on a Debian server using
apt-get.

But I have problems doing anything:

I installed as root, but trying doing things as my local user "me"

me> createuser me
createuser: could not connect to database postgres: FATAL: role "me"
does not exist

Then, trying the same as root, but gettinge the same result.

root> createuser me
createuser: could not connect to database postgres: FATAL: role
"root" does not exist

Then trying with the -U postgres option.

root> createuser -U postgres me
createuser: could not connect to database postgres: FATAL: Peer
authentication failed for user "postgres"

How do I get started?

https://wiki.debian.org/PostgreSql#User_access