How to use createdb command with newly created user?

From: 毛毛 <krave(at)163(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: How to use createdb command with newly created user?
Date: 2024-06-23 18:43:06
Message-ID: 540f69f.2ec4.1904668b6c4.Coremail.krave@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2024-06-23 18:47:44 Re: How to use createdb command with newly created user?
Previous Message Tom Lane 2024-06-23 18:32:09 Re: Stack Smashing Detected When Executing initdb