changing the PostgreSQL default user

Shane Ambler FreeBSD at ShaneWare.Biz
Tue Oct 22 07:02:37 UTC 2019


On 21/10/19 4:52 pm, David Newman wrote:
> Greetings.
> 
> FreeBSD recently changed its default version of PostgreSQL from 9.5 to 11.
> 
> However, attempts to run 'pg_upgrade' on the databases failed for me
> because my 9.5 install had a default user of 'pgsql' and version 11 goes
> with 'postgres' instead [1].
> 
> My hack was to edit /usr/local/etc/rc.d/postgresql, set postgresql_user

No need - configure it in /etc/rc.conf

Config variables used by any rc script can be set in rc.conf, not just
the *_enable variables.

For postgresql*-server that is
postgresql_enable
postgresql_data
postgresql_flags
postgresql_initdb_flags
postgresql_class
postgresql_profiles

In the postgresql rc file, you will find -

postgresql_user=${postgresql_user:-"postgres"}

the part inside ${} means if this variable has not been set use this
default value.

-- 
FreeBSD - the place to B...Sharing Data

Shane Ambler



More information about the freebsd-questions mailing list