PostgreSQLインスタンス内のデータベースを一覧表示する
公開日: 30 July 2019
インストールしたくないhttps://www.pgadmin.org/[pgAdmin] ou phppgadmin ただし、すべてがコマンドラインに存在している。
そのため、ターミナルを起動し、postgres ユーザーとして接続する必要があります。
Postgresユーザーはデフォルトでpsqlアプリケーションを起動する権限を持つ唯一のユーザーです。 psqlはコマンドラインクライアントです。 (コマンドラインインターフェース) postgresql,
ターミナルからコマンドラインでデータベースと通信できるようにするため
接続するには、ターミナルを起動し、これを入力してください:
$ sudo -i -u postgres
PostgreSQLのコマンドプロンプトに直接接続し、ログインするには、次のように入力してください :
$ sudo -i -u postgres psql
PostgreSQLのインスタンスのデータベースを一覧表示するコマンドは次の通りです :
postgres=# \l
結果:
データベースの一覧 名前 | 所有者 | エンコーディング | ソート順 | 文字種 | アクセス権
fiber | tech | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =Tc/tech
| | | | | tech=CTc/tech fiberdev | tech | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =Tc/tech
| | | | | tech=CTc/tech fiberweb | tech | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =Tc/tech
| | | | | tech=CTc/tech postgres | postgres | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | template0 | postgres | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =c/postgres
| | | | | postgres=CTc/postgres template1 | postgres | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =c/postgres
| | | | | postgres=CTc/postgres (6行)
qを押して結果表示を終了する
インスタンスのスキーマをリストするには postgresl.
postgres=# SELECT schema_name FROM information_schema.schemata;
結果
公共の インフォメーションスキーマ pg_catalog pg_toast_temp_1 pg_temp_1 pg_toast (6行)
ou
postgres=# SELECT nspname FROM pg_catalog.pg_namespace;
結果
pg_toast pg_temp_1 pg_toast_temp_1 pg_catalog information_schema 公開 (6 行)
関連記事
31 May 2026
14 May 2026