我需要显示所有找到的数据库名称。
我已经找到了从已知数据库获取信息的解决方案,但在我的情况下,我不知道"database_name.db"。
有人可以帮我!
好吧,你不必:
psql -h localhost -U pguser -c 'l'
通过这种方式,您将连接到默认数据库(称为postgres(。postgres连接需要连接到数据库。输出:
数据库列表名称|所有者|编码|排序规则|类型|访问权限-----------+----------+----------+-------------+-------------+-----------------------mytestdb|postgres|UTF8|en_CA.UTF-8 | en_CA.UT8|imdb|postgres|UTF8|en_CA.UTF-8 | en_CA.UT8|postgres|postgres|UTF8|en_CA.UTF-8 | en_CA.UT8|template0|postgres|UTF8|en_CA.UTF-8 | en_CA.UTF-8|=c/postgres+||||postgres=CTc/postgrestemplate1|postgres|UTF8|en_CA.UTF-8 | en_CA.UTF-8|=c/postgres+||||postgres=CTc/postgres