Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using qgis 1.8 on Ubuntu 10.04 with Postgres 8.4.13

I am creating a new (and my first) Postgresql connection in qgis.

I can connect to the user and the db using the pgsql client.

jlam@lusk:~/programmation/Quantum-GIS/build-master/output/bin$ psql -U qgis -W qgis -p 5432
Mot de passe pour l'utilisateur qgis : 
psql (8.4.13)
Saisissez « help » pour l'aide.

qgis=> \q

But when testing the same parameters within the PostGIS connection creation dialog box, I get connection failure:

"La connexion échouée - Réglez la connexion et réessayez"

("Connection failed - Fix the connection and try again")

My pg_hba.conf file includes the line:

# "local" is for Unix domain socket connections only
local   all         qgis                          md5 

Is there a way I can get qgis to send me back the error code and error string it gets from postgres, if its connecting at all, or to increase debug output on the console?

share|improve this question
When you connect via command line using psql, you're passing the -W flag, which forces it not to ask for a password. According to the line in your pg_hba.conf, your system is set up to use md5 password encryption. I'm guessing that within QGIS, the password is not being supplied correctly. What happens if you change your pg_hba.conf from md5 to trust? Since you're only connecting locally, security shouldn't be a major problem. – L_Holcombe Oct 11 '12 at 3:41
I'm afraid I still get the same error. Just realized it's connecting via IPv4 or IPv6, not the socket, since qgis asks me for port number. – Julien Lamarche Oct 11 '12 at 19:24
# IPv4 local connections: host all all md5 # IPv6 local connections: host all all ::1/128 md5 – Julien Lamarche Oct 11 '12 at 19:28
you can also set your IPv4 connection to use trust which should allow you to connect locally. – djq Oct 12 '12 at 1:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.