Re: Issue upgrading from 9.5 to 13 with pg_upgrade: "connection to database failed: FATAL: database "template1" does not exist"

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Jeremy Wilson <jwilson(at)clover(dot)co>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Issue upgrading from 9.5 to 13 with pg_upgrade: "connection to database failed: FATAL: database "template1" does not exist"
Date: 2020-11-13 18:14:53
Message-ID: caf8b083-90a7-fb50-eb2e-c57396e5a191@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/13/20 9:12 AM, Jeremy Wilson wrote:
>
>
>> On Nov 13, 2020, at 12:06 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>>
>> Hmm. You can still connect if you use?:
>>
>> /usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile start
>
> Same result.
>
> bash-4.4$ /usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile start
> waiting for server to start.... done
> server started
> bash-4.4$ psql postgres
> psql: error: could not connect to server: FATAL: database "postgres" does not exist
>

In this post:

https://www.postgresql.org/message-id/793E4164-90E9-41F0-B74C-129E1DB76408%40clover.co

it worked. Though in that case pg_upgrade was not run before you ran:

/usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile start

Can you start with clean initdb and then run above command to see if you
can connect. Then run:

/usr/pgsql-13/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D
"/var/lib/pgsql/13/data" -o "-p 5432 -b -c synchronous_commit=off -c
fsync=off -c full_page_writes=off -c vacuum_defer_cleanup_age=0 -c
listen_addresses='' -c unix_socket_permissions=0700 -c
unix_socket_directories='/var/lib/pgsql'" start

and see if you can connect. Leave pg_upgrade out of the mix to see if it
is indeed the issue.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeremy Wilson 2020-11-13 19:19:21 Re: Issue upgrading from 9.5 to 13 with pg_upgrade: "connection to database failed: FATAL: database "template1" does not exist"
Previous Message Radoslav Nedyalkov 2020-11-13 18:13:42 Re: conflict with recovery when delay is gone