Password Authentication Fails with Postgres


I’m using Nextcloud on Armbian (customized Ubuntu 18.04), with Postgresql 10.1 and Nginx.

When I try to run the installation program (using the command line), I get an error:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] FATAL:  password authentication failed for user "nextcloud"
FATAL:  password authentication failed for user "nextcloud"

I made sure in pg_hba.conf that md5 is an allowed auth method on localhost. I’ve confirmed with sudo -u www-data psql -U nextcloud nextcloud that I’m able to log in to the database using the password that I’ve given to the occ command.

The exact command I used is:

sudo -u www-data php occ maintenance:install --database "pgsql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "{database pass}" --admin-user "miakramer" --admin-pass "{admin pass}" --data-dir "/data/www/nextcloud/data" --database-host "localhost:5432"

Any thoughts on what I might be doing wrong?