Обсуждение: createdb: could not connect

Поиск
Список
Период
Сортировка

createdb: could not connect

От
"stephenc"
Дата:

I am trying to do 1.3 of help - that is create a database.

 

I'm om winmdows XP.

 

I have installed postgresql.  I can open tools like pgAdmin.

 

I have two command prompt screens I can get up from the all programs menu:

 

 

C:\Program Files\PostgreSQL\8.1\bin>createdb mydb

Password:

createdb: could not connect to database postgres: FATAL:  password authenticatio

n failed for user "stephenc"

 

and

 

Welcome to psql 8.1.3, the PostgreSQL interactive terminal.

 

Type:  \copyright for distribution terms

       \h for help with SQL commands

       \? for help with psql commands

       \g or terminate with semicolon to execute query

       \q to quit

 

Warning: Console code page (437) differs from Windows code page (1252)

         8-bit characters may not work correctly. See psql reference

         page "Notes for Windows users" for details.

 

postgres=# makedb mydb

postgres-#

 

As you can see neither of them did what was meant to happen which is I should have got the response:

 

CREATE DATABASE

 

I think this is something to do with the password, but now I am lost.  Can someone tell me how to set the password?  Incidentally, I never created a user stephenc.  That is just the name of my user account on the xp box.

 

Any help most welcome.

 

 

 

 

Stephen Choularton

02 9999 2226

0413 545 182

 


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 22/03/2007 7:44 AM

Re: createdb: could not connect

От
Tom Lane
Дата:
"stephenc" <mail@xesoftware.com.au> writes:
> postgres=# makedb mydb
> postgres-#

The reason that doesn't work is that (1) makedb is not a SQL command
in Postgres, and (2) since you didn't type a semicolon, psql thinks
the command is incomplete and is waiting for you to type another line
of command.  You would have gotten a syntax error when you did enter
a semicolon, because the right command syntax is "CREATE DATABASE mydb;"

> I think this is something to do with the password, but now I am lost.  Can
> someone tell me how to set the password?  Incidentally, I never created a
> user stephenc.  That is just the name of my user account on the xp box.

You seem to be able to get into psql OK, so it's not clear to me why
createdb didn't work.  Perhaps you specified a -U option to psql but
forgot it for createdb?

            regards, tom lane