【发布时间】:2021-06-27 21:32:00
【问题描述】:
我需要显示所有找到的数据库名称。
我找到了从已知数据库获取信息的解决方案,但就我而言,我不知道“database_name.db”。
谁能帮帮我!
【问题讨论】:
-
@eshirvana 这可能是一个答案,但我没有
database字段,该字段是我不知道且我想获得的字段。谢谢
标签: python mysql postgresql django-rest-framework
我需要显示所有找到的数据库名称。
我找到了从已知数据库获取信息的解决方案,但就我而言,我不知道“database_name.db”。
谁能帮帮我!
【问题讨论】:
database 字段,该字段是我不知道且我想获得的字段。谢谢
标签: python mysql postgresql django-rest-framework
好吧,你不必这样做:
psql -h localhost -U pguser -c '\l'
这样您将连接到默认数据库(称为 postgres)。 postgres 连接需要连接到数据库。 输出:
数据库列表
姓名 |所有者 |编码 |整理 |类型 |访问权限
------------+----------+----------+-------------+-- -----------+-----------
我的测试数据库 |后勤 | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
数据库 |后勤 | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
后勤 |后勤 | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
模板0 |后勤 | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
模板1 |后勤 | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
【讨论】: