Re:Re: How to use createdb command with newly created user?

From: 毛毛 <krave(at)163(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re:Re: How to use createdb command with newly created user?
Date: 2024-06-23 19:22:19
Message-ID: 6697c935.2f13.190468ca053.Coremail.krave@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you! You are right!

After putting quotes around the username, it works!

在 2024-06-24 02:47:44,"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 写道:

On Sun, Jun 23, 2024, 11:43 毛毛 <krave(at)163(dot)com> wrote:

Hi,

I tried to create a user with CREATEDB permission.
Then I wanted to run command line tool `createdb` with this newly created user.

So I ran SQL first to create a user:

```

CREATE USER Baba WITH PASSWORD 'xxx' CREATEDB;

```

Then I run the following command on PowerShell on Windows 10:

```
createdb -U Baba -W test_db
```

But no mater how I tried, the password always failed.

If I specify the user as postgres, the defaut user, everything works fine.

```
createdb -U postgres -W test_db_1
```

Do you have any suggestions?

You named the user "baba" all lower-case but your createdb command uses Baba and in the OS the case-folding of identifiers does not happen. Baba != baba is your issue.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-06-23 19:38:21 Re: Re: How to use createdb command with newly created user?
Previous Message Tom Lane 2024-06-23 19:00:37 Re: How to use createdb command with newly created user?