1

I created a database named "wchiba" in postgres using :

create database wchiba; 

Then I create a user :

create a user saifeddine with password "0000";

Then I grant privileges :

grant all on database wchiba to saifeddine;

Everything now is ok

But when I load a shapefile to my table I have this problem of password

FATAL:  password authentication failed for user "wchiba" 

Also my database is wchiba not the user while the user created is saifeddine.

What's going on?

enter image description hereenter image description here

Does anyone know how to configure pg_hba.config

closed as off-topic by Vince, Fran Raga, JGH, BERA, xunilk May 19 at 23:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2

If you want to login as a user other than the default you must tell psql. Please read the documentation.

psql -U saifeddine -d wchiba 

will log you into Postgresql as the user saifeddine and connected to the wchiba database.

However this has nothing to do with loading a shapefile, so you probably want shp2psql which also takes a -u username option, see this document. In this case something like:

shp2pgsql -s 4326 watershed myschema.watershed | psql -d wchiba -U saifeddine

You will need to use the correct CRS for your data which may not be epsg:4326.

  • Thank you for the explanation bit i had this psql: FATAL: could not load pg_hba.conf after writing shp2pgsql -s 32632 watershed myschema.watershed | psql -d wchiba -U saifeddine – Saifeddine Farjallah May 18 at 15:13
  • I changed configuration of pg_hba.config from md5 to trust and it works now – Saifeddine Farjallah May 18 at 15:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.