Home:ALL Converter>redhat pg_upgrade permission errors

redhat pg_upgrade permission errors

Ask Time:2019-10-30T01:45:00         Author:Jelly Wu

Json Formatter

duplicate of unanswered question:

CentOS 7 pg_upgrade Permissions Errors

when trying to run pg_upgrade, it won't let me run the command as root. when exiting from root, it can't access files due to permissions. how can this be solved?

command i'm running:

/usr/pgsql-12/bin/pg_upgrade --old-bindir=/usr/pgsql-10/bin/ --new-bindir=/usr/pgsql-12/bin/ --old-datadir=/var/lib/pgsql/10/data/ --new-datadir=/var/lib/pgsql/12/data/

error message when running command as root:

pg_upgrade: cannot be run as root
Failure, exiting

error message when not running command as root:

could not open version file: /var/lib/pgsql/10/data/PG_VERSION
Failure, exiting

also tried to run command as postgres user

su postgres

/usr/pgsql-12/bin/pg_upgrade --old-bindir=/usr/pgsql-10/bin/ --new-bindir=/usr/pgsql-12/bin/ --old-datadir=/var/lib/pgsql/10/data/ --new-datadir=/var/lib/pgsql/12/data

could not change directory to "/home/j.d": Permission denied

could not open log file "pg_upgrade_internal.log": Permission denied
Failure, exiting

Author:Jelly Wu,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58612861/redhat-pg-upgrade-permission-errors
yy