0

I've setup a local postgresql database, and as it's a local database, I'm not worried about security or authentication. I'm currently using this database with QGis and PostGIS to store geometry data. As such, I've set all the connections within the pg_hba.conf file to trusted. When I load pgAdmin4, I have full access to the database server without having to enter credentials.

However, everytime I start QGis, it is asking for credentials for the database, even though everything should be set to trust.

How can I enable QGis to not ask for a password to the postgresql database when I use QGis?

My pg_hba.conf file:

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres                                trust

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

My connection details look like: dbname='gis_data' host=127.0.0.1 port=5432

The error I get from QGis is: FATAL: role "<username>" does not exist

My system is currently running Linux Mint 19 x64 with Postgresql 10.5.

Cheers, Justin

Juzzbott
  • 101
  • 1

2 Answers2

0

Usually you can prevent PostgreSQL credential prompts by telling QGIS to 'store' the credentials in the QGIS file.

settings

Be warned, using the 'Basic' Authentication as shown above, will stored the credentials in plain text, within the .qgs/.qgz file. Use the 'Configurations' option instead for additional security.

Theo F
  • 101
0

Which operating system account is QGIS running under?

Is that the same as the "<username>" you quoted?

If so, then I suspect that account will need to be added to the database.

Phill W.
  • 1,479
  • 7
  • 7