pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ozan Kahramanogullari <ozan.kah@gmail.com>
Cc: Andrej Ricnik <andrej.groups@gmail.com>
Cc: Jeff Frost <jeff.frost@gmail.com>
Cc: pgsql-novice@postgresql.org
Subject: Re: psql on Mac
Date: Wed, 24 Oct 2018 14:01:16 +0100
Message-ID: <19578.1540386076@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPiqqLnoSDKzAWYQn_KpGVzfd84LiknHT6BC-MW8-rZJMce8Pg@mail.gmail.com>
References: <CAPiqqLnNNoSw=MYKH=6ThhphWX33LzVg5UVDKxQr_Bj-94u4dQ@mail.gmail.com>
	<CABEGHMGq737p7QeQuxiFzrai=e6bX8WeGXNt3kRPsDSLnjesuw@mail.gmail.com>
	<CAPiqqLkXxUk1q+pDeuxwpESLrssJseLyR=3mBNJPF=3JP6j-Cw@mail.gmail.com>
	<CABEGHMFnoy3zmzY_WwUVt_Eq+8RF36soapyt8CPit9pkWaY_XA@mail.gmail.com>
	<CAPiqqL=KxV9xE9U_9MGp7_DmdYKCcfMe0UFHN2j94Y68k_2cdA@mail.gmail.com>
	<CACMx3pMD5E+aW+4Vc-4cHOJUy8AwJh==hGUrZVAAmFkSWs9BQw@mail.gmail.com>
	<CAPiqqLn8v+MwEWJiH28jxvw3f2TUvrS+uKq5RcO5wBZEqZwJ6g@mail.gmail.com>
	<CAPiqqL=9VLg2n+tWSh76hD1v=f1LdsonAay3BQX2-LEvhvbURw@mail.gmail.com>
	<19047.1540372132@sss.pgh.pa.us>
	<CAPiqqLnsgE+CiRAsdtNHiUpODPi1WSKH2QxE5irDbTJwhn_O=w@mail.gmail.com>
	<19143.1540374143@sss.pgh.pa.us>
	<CAPiqqL=S8+ns8zGwjSfCR24hq8GEsd4Uj=XsNEw+rJ2Y=oY=OA@mail.gmail.com>
	<19247.1540376672@sss.pgh.pa.us>
	<CAPiqqLn3-=eG5wCqwpe31Nrh0TD2_2504EiZBg53ZdmtY5LevA@mail.gmail.com>
	<19344.1540378030@sss.pgh.pa.us>
	<CAPiqqL=ffc1b5k=u4X7ogVcPaw8DT+h2iJpHmAK4WWKC7AyaPg@mail.gmail.com>
	<19442.1540380127! @sss.pgh.pa.us>
	<CAPiqqLnoSDKzAWYQn_KpGVzfd84LiknHT6BC-MW8-rZJMce8Pg@mail.gmail.com>

Ozan Kahramanogullari <ozan.kah@gmail.com> writes:
> I get these:

> XXX:~ ozan$ nslookup localhost
> Server: 192.168.206.99
> Address: 192.168.206.99#53
> Name: localhost.unitn.it
> Address: 10.31.101.168

Well, *that's* screwed up.  You should complain to your local network
manager about it.  "localhost" ought to resolve to 127.0.0.1,
or ::1/128 in IPv6-land, not something else.  It's possible that
10.31.101.168 is your Mac's address, but that still doesn't make this
correct behavior.  So for the moment, don't use "-h localhost".

> I first try this:
> XXX:~ ozan$ psql -h 127.0.0.1
> psql: FATAL:  database "ozan" does not exist

Check ...

> XXX:~ ozan$ psql -U postgres
> psql (10.5)
> Type "help" for help.

> postgres=# CREATE USER ozan WITH PASSWORD 'parrot';
> ERROR:  role "ozan" already exists
> postgres=# CREATE DATABASE lecture;
> ERROR:  database "lecture" already exists
> postgres=# GRANT ALL PRIVILEGES ON DATABASE lecture to ozan;
> GRANT

That's all fine, but you didn't create a database named "ozan",
so it's unsurprising that you get this:

> XXX:~ ozan$ psql -h 127.0.0.1
> psql: FATAL:  database "ozan" does not exist

If you want the connection to go to the database named "lecture",
you need to say "psql lecture", or some more verbose form of that
such as "psql -h 127.0.0.1 -U ozan lecture".  When you don't mention
a database on the command line, psql's default behavior is to try
to connect to a database named the same as the user.

			regards, tom lane




view thread (25+ messages)  latest in thread

Message-ID: <19578.1540386076@sss.pgh.pa.us>
Permalink:  ../19578.1540386076@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19578.1540386076@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ozan.kah@gmail.com, andrej.groups@gmail.com, jeff.frost@gmail.com, pgsql-novice@postgresql.org
  Subject: Re: psql on Mac
  In-Reply-To: <19578.1540386076@sss.pgh.pa.us>
  References: <CAPiqqLnNNoSw=MYKH=6ThhphWX33LzVg5UVDKxQr_Bj-94u4dQ@mail.gmail.com> <CABEGHMFnoy3zmzY_WwUVt_Eq+8RF36soapyt8CPit9pkWaY_XA@mail.gmail.com> <CAPiqqL=KxV9xE9U_9MGp7_DmdYKCcfMe0UFHN2j94Y68k_2cdA@mail.gmail.com> <CACMx3pMD5E+aW+4Vc-4cHOJUy8AwJh==hGUrZVAAmFkSWs9BQw@mail.gmail.com> <CAPiqqLn8v+MwEWJiH28jxvw3f2TUvrS+uKq5RcO5wBZEqZwJ6g@mail.gmail.com> <CAPiqqL=9VLg2n+tWSh76hD1v=f1LdsonAay3BQX2-LEvhvbURw@mail.gmail.com> <19047.1540372132@sss.pgh.pa.us> <CAPiqqLnsgE+CiRAsdtNHiUpODPi1WSKH2QxE5irDbTJwhn_O=w@mail.gmail.com> <19143.1540374143@sss.pgh.pa.us> <CAPiqqL=S8+ns8zGwjSfCR24hq8GEsd4Uj=XsNEw+rJ2Y=oY=OA@mail.gmail.com> <19247.1540376672@sss.pgh.pa.us> <CAPiqqLn3-=eG5wCqwpe31Nrh0TD2_2504EiZBg53ZdmtY5LevA@mail.gmail.com> <19344.1540378030@sss.pgh.pa.us> <CAPiqqL=ffc1b5k=u4X7ogVcPaw8DT+h2iJpHmAK4WWKC7AyaPg@mail.gmail.com> <CAPiqqLnoSDKzAWYQn_KpGVzfd84LiknHT6BC-MW8-rZJMce8Pg@mail.gmail.com> <19578.1540386076@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox