我想在运行psql
命令时设置Windows上PostgreSQL安装的默认角色。
我相信我已经根据an answer in another StackOverflow question使用以下命令正确创建了角色:
# Log in the root role
psql -U postgres
# Create role
create user Mathe with password '123';
字符串
如果我再次运行create user
,我会得到:
错误:角色“mathe”已存在
当我不带参数再次运行psql
时,我得到:
psql:error:connection to server at“localhost”(::1),port 5432 failed:FATAL:role“Mathe”does not exist
我相信,这是因为第一个字母的缘故。我怎么才能改变这个默认角色呢?
根据评论,我已经尝试过在没有任何东西的情况下运行psql
来解决上述问题:
postgres-# ALTER ROLE Mathe
postgres-# SET LOGIN = true
postgres-# SET NOLOGIN = false
型
你知道为什么我会得到和上面一样的输出吗?
我已经尝试了@Luuk的命令:
C:\Users\Mathe>psql -U postgres
psql (16.0)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# ALTER ROLE "mathe" RENAME TO "Mathe"
postgres-# \du
List of roles
Role name | Attributes
-----------+------------------------------------------------------------
hydroper |
mathe |
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS
型
我试了psql
如下:
C:\Users\Mathe>psql -U mathe
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "mathe" does not exist
C:\Users\Mathe>psql -U Mathe
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: role "Mathe" does not exist
型
1条答案
按热度按时间js5cn81o1#
2个选择:
1.第一个月
字符串
P.S.您的系统上的属性可能会有所不同。