0

I'm trying to follow the tutorial here: https://gophercasts.io/lessons/4-postgres-basics but I'm having problems with the way in which the user is set up in Windows 8.1 (64-bit).

The tutorial has a data.sql which is a script to create some seed data for the purposes of the tutorial but when I try and run it through the command line I get this error:

createdb: could not connect to database template1: FATAL: password authentication failed for user "user"

The command I ran was :

C:\code\gocode>createdb lesson4

My Windows account is just called 'user'. Also when I open pgadmin3 the only Postgresql account I see is called 'postgres'.

How do I set up an account so I can run commands from the command-line?

(Apologies in advance if this is the incorrect forum, I wasn't sure if I should post it here, or Stackoverflow or DBA Stackexchange, please do not punish me with downvotes, just let me know if I should get it moved elsewhere)

1
  • You have to allow access through your pg_hba.conf file. This may involve creating a database user too. If the link doesn't help, post the contents of your pg_hba.conf file. Commented Jul 30, 2014 at 17:50

1 Answer 1

-1

Create a windows user account called 'postgres' with a password 'postgres'(or whatever password you set for your postgres server). then run your script again. Make sure you have admin priviledges too.

In fact if you are using window rather install pgAdmin and user the graphic user interface to create the database and run the script. It will save a lot of time.

http://www.pgadmin.org/download/windows.php

2
  • I mentioned in my post that that account is already there. I did try and use the pgadmin interface, but there is an underlying problem because when I try and run the Golang script I get more errors which I believe are related to these user accounts. Basically, using pgadmin works but doesn't solve the problem.
    – warsong
    Commented Jul 23, 2014 at 10:25
  • Tried with admin privileges, same error :(
    – warsong
    Commented Jul 23, 2014 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .