Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLSFw-00EwjU-Uc for pgsql-general@arkaria.postgresql.org; Sun, 23 Jun 2024 18:48:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sLSFv-00FFkm-C7 for pgsql-general@arkaria.postgresql.org; Sun, 23 Jun 2024 18:48:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLSFu-00FFkd-Ur for pgsql-general@lists.postgresql.org; Sun, 23 Jun 2024 18:48:03 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sLSFo-003B39-Pq for pgsql-general@lists.postgresql.org; Sun, 23 Jun 2024 18:48:02 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-25980546baeso1792704fac.2 for ; Sun, 23 Jun 2024 11:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719168475; x=1719773275; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0E1ybfQuvjb5sJFz+goNOdcqer0/1Gj99dpedFCa/RA=; b=gtUVMlFcaVkJwrn+wgGGPF5dlvELJxGItvddL7K4LjF+CvZtOQzMcrscBMW5xSn581 uk6dE8TEvoyTm0O/AyqNVuz7Xsziq/71CcKxwAQPRNh9jB1+oD2AdSJy5s5RIiNUb7iL QWw/KJP1Ms1PqS1Yfp35UTP4CTiGBbZBd4ddhGl2xUIT0nypk2fxR7cbtAYyIJ/P95tM l/fAnt1+7ZsG3XBy9euPkegfgdb+7B9UoC9UkSBc8cTsuC7RdmnEgrRF82qztfRQ0+o5 3fLutP2FQx4eW1K1qT7bGepmpaIptEUVdgzhcFIHaDkLdNmKb7vqpRTg9M1G9k1ctMab 8yNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719168475; x=1719773275; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0E1ybfQuvjb5sJFz+goNOdcqer0/1Gj99dpedFCa/RA=; b=jlkv8g9H8YOtyVM5xx3PrAumHoA1jn95AbvPzaeJPmp6IVddiiDS7SCLQnM0Z87Eda 57z3lDWWTEF4tWfDzDUZzA7qliNX15SDY+eDGKcMnzHTE4KxkhNjRAzN4dHL5og2RyQ1 Q+nYgtL3joo9h+un8m4T+GgjBlyp5d+OAHmWu8DAwr/hizBKsiRybToXYQtceMPB8UKm YD7zp1QFZUja9M3JTt32ZFkk4LLFvZH6QbP56bUxpO1ItdAUxiYcEORt8Tm6KJeZCVBC 1pfULGhUzPzA1DJ+nLLxGBxEHVvGdWQuLecQgvNsP2Gmb49cw9joRxN0LWbE1ZtbtQ2b HRRw== X-Gm-Message-State: AOJu0Yz12zuN0KU/fN7hfzM3ja4LcSn0kFKIyrtcx+uIXI6OOuRDBHcx UQnqkmpuqA24Klf8uSFj1mjotBcEfXi38SENcJ73tvV/wotSlm0H64CVUWifDszWHFLeDPWXgQ+ iN8WFcfzqTGie3UieMKgPfkCre7Q= X-Google-Smtp-Source: AGHT+IFhdy2nbLMtU5nMR/u09zKRuUYVm1CTFvtqvKC4g0ox1+lWOT/awYT4QAl2dQLHmMleYmpviqBv9twqwNm3aEs= X-Received: by 2002:a05:6871:610:b0:258:7bca:3289 with SMTP id 586e51a60fabf-25cfcfa4355mr3707458fac.51.1719168474643; Sun, 23 Jun 2024 11:47:54 -0700 (PDT) MIME-Version: 1.0 References: <540f69f.2ec4.1904668b6c4.Coremail.krave@163.com> In-Reply-To: <540f69f.2ec4.1904668b6c4.Coremail.krave@163.com> From: "David G. Johnston" Date: Sun, 23 Jun 2024 11:47:44 -0700 Message-ID: Subject: Re: How to use createdb command with newly created user? To: =?UTF-8?B?5q+b5q+b?= Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000003d8464061b931a49" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003d8464061b931a49 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jun 23, 2024, 11:43 =E6=AF=9B=E6=AF=9B 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 !=3D baba is your issue. David J. --0000000000003d8464061b931a49 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, Jun 23, 2024, 11:43 =E6=AF=9B=E6=AF=9B <krave@163.com> wrote:
Hi,

I tried to create a user with CR= EATEDB permission.
Then I wanted to run comman= d line tool `createdb` with this newly created user.

So I ran SQL first to create a use= r:

```
CREATE USER Baba WITH PASSWORD 'xxx' CR= EATEDB;
```
<= br>
Then I run the following command on PowerS= hell on Windows 10:

```
=C2=A0createdb -U Baba -W test_db<= /div>
```

But no mater how I tried, the password always failed.<= /div>

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.=C2=A0 Baba !=3D ba= ba=C2=A0 is your issue.

= David J.
--0000000000003d8464061b931a49--