I want to load shp data in my postgis enabled database. I am typing the command:

shp2pgsql -s 4326 -G -I "shapefile_name" public.table_name | 
psql -h localhost -p 5432 -d gis -U postgres

and I am prompted to enter my password. After entering the right password I get the following message:

psql: FATAL: password authentication failed for user "postgres"

Is there a configuration that has to be made in the pg_hba.conf file?

  • Try setting PGPASSWORD=yourpassword after the Pipe and before the psql staement.
    – Matte
    Jul 19 '16 at 9:30
  • 1
    I deleted this part: -h localhost -p 5432 and it worked Jul 20 '16 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.