public inbox for [email protected]help / color / mirror / Atom feed
How to use createdb command with newly created user? 5+ messages / 4 participants [nested] [flat]
* How to use createdb command with newly created user? @ 2024-06-23 18:43 =?GBK?B?w6vDqw==?= <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: =?GBK?B?w6vDqw==?= @ 2024-06-23 18:43 UTC (permalink / raw) To: [email protected] 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? ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to use createdb command with newly created user? @ 2024-06-23 18:47 David G. Johnston <[email protected]> parent: =?GBK?B?w6vDqw==?= <[email protected]> 0 siblings, 2 replies; 5+ messages in thread From: David G. Johnston @ 2024-06-23 18:47 UTC (permalink / raw) To: 毛毛 <[email protected]>; +Cc: [email protected] On Sun, Jun 23, 2024, 11:43 毛毛 <[email protected]> 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. ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to use createdb command with newly created user? @ 2024-06-23 19:00 Tom Lane <[email protected]> parent: David G. Johnston <[email protected]> 1 sibling, 0 replies; 5+ messages in thread From: Tom Lane @ 2024-06-23 19:00 UTC (permalink / raw) To: David G. Johnston <[email protected]>; +Cc: 毛毛 <[email protected]>; [email protected] "David G. Johnston" <[email protected]> writes: > On Sun, Jun 23, 2024, 11:43 毛毛 <[email protected]> wrote: >> 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. > 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. FWIW, I think using -W in interactive commands is a bad habit that you should drop. Because it forces a password prompt, it easily confuses people into thinking that their problem is password-related whether it actually is or not. (I notice that with createdb, it actually seems to force *two* password prompts when there is something wrong. That's unlike what happens with psql; maybe we should try to improve that. But on the other hand, it's hard to get excited about putting work into improving a behavior that we deprecate using at all.) regards, tom lane ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re:Re: How to use createdb command with newly created user? @ 2024-06-23 19:22 =?GBK?B?w6vDqw==?= <[email protected]> parent: David G. Johnston <[email protected]> 1 sibling, 1 reply; 5+ messages in thread From: =?GBK?B?w6vDqw==?= @ 2024-06-23 19:22 UTC (permalink / raw) To: David G. Johnston <[email protected]>; +Cc: [email protected] Thank you! You are right! After putting quotes around the username, it works! 在 2024-06-24 02:47:44,"David G. Johnston" <[email protected]> 写道: On Sun, Jun 23, 2024, 11:43 毛毛 <[email protected]> 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. ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Re: How to use createdb command with newly created user? @ 2024-06-23 19:38 Ron Johnson <[email protected]> parent: =?GBK?B?w6vDqw==?= <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Ron Johnson @ 2024-06-23 19:38 UTC (permalink / raw) To: pgsql-generallists.postgresql.org <[email protected]> Better to run now, and save yourself hassle in the future: ALTER ROLE "Baba" RENAME TO baba; Also, use a .pgpass file: https://www.postgresql.org/docs/14/libpq-pgpass.html On Sun, Jun 23, 2024 at 3:22 PM 毛毛 <[email protected]> wrote: > > > Thank you! You are right! > > After putting quotes around the username, it works! > > > > 在 2024-06-24 02:47:44,"David G. Johnston" <[email protected]> 写道: > > > > On Sun, Jun 23, 2024, 11:43 毛毛 <[email protected]> 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. > > ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2024-06-23 19:38 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-06-23 18:43 How to use createdb command with newly created user? =?GBK?B?w6vDqw==?= <[email protected]> 2024-06-23 18:47 ` David G. Johnston <[email protected]> 2024-06-23 19:00 ` Tom Lane <[email protected]> 2024-06-23 19:22 ` =?GBK?B?w6vDqw==?= <[email protected]> 2024-06-23 19:38 ` Ron Johnson <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox