Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFImw-0003Sx-RB for pgsql-novice@arkaria.postgresql.org; Wed, 24 Oct 2018 13:01:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gFImu-00070n-20 for pgsql-novice@arkaria.postgresql.org; Wed, 24 Oct 2018 13:01:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFImt-00070e-Rt for pgsql-novice@lists.postgresql.org; Wed, 24 Oct 2018 13:01:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFImn-0006HO-5k for pgsql-novice@postgresql.org; Wed, 24 Oct 2018 13:01:27 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9OD1GC1021112; Wed, 24 Oct 2018 09:01:16 -0400 From: Tom Lane To: Ozan Kahramanogullari cc: Andrej Ricnik , Jeff Frost , pgsql-novice@postgresql.org Subject: Re: psql on Mac In-reply-to: References: <19047.1540372132@sss.pgh.pa.us> <19143.1540374143@sss.pgh.pa.us> <19247.1540376672@sss.pgh.pa.us> <19344.1540378030@sss.pgh.pa.us> <19442.1540380127! @sss.pgh.pa.us> Comments: In-reply-to Ozan Kahramanogullari message dated "Wed, 24 Oct 2018 14:02:14 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19577.1540386076.1@sss.pgh.pa.us> Date: Wed, 24 Oct 2018 14:01:16 +0100 Message-ID: <19578.1540386076@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ozan Kahramanogullari 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