How do I connect to PostgreSQL without specifying a database name?

前端 未结 3 1108
清歌不尽
清歌不尽 2020-12-28 11:49

I need to connect to some PostgreSQL server providing some credentials, and print a list of available databases on that host for a given user.

I am trying:



        
3条回答
  •  无人及你
    2020-12-28 12:26

    Why don't you connect to your Maintenance DB (usually postgres?). I don't know if that'll work. But I believe you'll have to query this database anyway to retrieve the databases available to a given user.

提交回复
热议问题