问题:我可以从shell(bash,OSX)创建用户或数据库,但无法从postgres cli中创建。从bash中,如果成功,我没有得到任何确认。
如果我尝试在psql中创建角色,则不会收到任何响应,也不会生成任何错误。如果我尝试从bash中使用createuser,则如果成功,则不会返回任何内容,如果失败,则会生成错误:“角色用户名已存在”。
如果我尝试在psql中创建角色,则不会收到任何响应,也不会生成任何错误。如果我尝试从bash中使用createuser,则如果成功,则不会返回任何内容,如果失败,则会生成错误:“角色用户名已存在”。
Example:
Yunti-# CREATE ROLE testuser
Yunti-# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
Yunti | Superuser, Create role, Create DB, Replication | {}
anything | | {}
monkey | | {}
Yunti-# CREATE DATABASE testdb
Yunti-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
Yunti | Yunti | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | Yunti | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | Yunti | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/Yunti +
| | | | | Yunti=CTc/Yunti
template1 | Yunti | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/Yunti +
| | | | | Yunti=CTc/Yunti
test | Yunti | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
test5 | Yunti | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(6 rows)
Yunti-#
使用createdb时也会发生类似的情况。
我如何在postgres cli中创建用户和数据库? 而且在bash中大多数postgres命令都没有响应,这正常吗?
信息:用户及其权限:
Yunti-# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
Yunti | Superuser, Create role, Create DB, Replication | {}
anything | | {}
monkey | | {}