> This page location: Administration Tips > Show Databases
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL Show Databases

**Summary**: in this tutorial, you will learn how to show databases in a PostgreSQL database server.

In MySQL, you can show all databases in the server using [`SHOW DATABASES`](https://www.mysqltutorial.org/mysql-administration/mysql-show-databases/) statement.

PostgreSQL does not directly support the `SHOW DATABASES` statement but offers you something similar. PostgreSQL provides you with two ways to show databases in a PostgreSQL database server.

## Listing databases in PostgreSQL using psql command

First, open the Command Prompt on Windows or Terminal on Unix-like systems and connect to the PostgreSQL server:

```bash
psql -U postgres
```

This statement uses the postgres user to connect to the local PostgreSQL server. It'll prompt you to enter a password.

Second, show all the databases in the current server using the `\l` command:

```
\l
```

It'll show the following output:

```
                                                                      List of databases
   Name    |  Owner   | Encoding | Locale Provider |          Collate           |           Ctype            | ICU Locale | ICU Rules |   Access privileges
-----------+----------+----------+-----------------+----------------------------+----------------------------+------------+-----------+-----------------------
 dvdrental | postgres | UTF8     | libc            | English_United States.1252 | English_United States.1252 |            |           |
 postgres  | postgres | UTF8     | libc            | English_United States.1252 | English_United States.1252 |            |           |
 template0 | postgres | UTF8     | libc            | English_United States.1252 | English_United States.1252 |            |           | =c/postgres          +
           |          |          |                 |                            |                            |            |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | libc            | English_United States.1252 | English_United States.1252 |            |           | =c/postgres          +
           |          |          |                 |                            |                            |            |           | postgres=CTc/postgres
(4 rows)
```

To display more information on databases, you can use the `\l+` command:

```
\l+
```

## Listing databases in PostgreSQL using SELECT statement

The following statement retrieves the database names from the `pg_database` view:

```sql
SELECT datname FROM pg_database;
```

Output:

```
  datname
-----------
 postgres
 dvdrental
 template1
 template0
(4 rows)
```

The query returns four databases in the current PostgreSQL server.

## Summary

- Use `\l` or `\l+` in `psql` to show all databases in a PostgreSQL database server.
- Use the `SELECT` statement to query data from the `pg_database` to retrieve all the database names in a PostgreSQL database server.

---

## Related docs (Administration Tips)

- [Reset Password](https://neon.com/postgresql/postgresql-administration/postgresql-reset-password)
- [Describe Table](https://neon.com/postgresql/postgresql-administration/postgresql-describe-table)
- [Show Tables](https://neon.com/postgresql/postgresql-administration/postgresql-show-tables)
- [Practical psql Commands](https://neon.com/postgresql/postgresql-administration/psql-commands)
- [Restart PostgreSQL on Windows](https://neon.com/postgresql/postgresql-administration/restart-postgresql-windows)
- [Restart PostgreSQL on Ubuntu](https://neon.com/postgresql/postgresql-administration/postgresql-restart-ubuntu)
- [Get PostgreSQL Version](https://neon.com/postgresql/postgresql-administration/postgresql-version)
- [Check PostgreSQL Uptime](https://neon.com/postgresql/postgresql-administration/postgresql-uptime)
- [Password File (.pgpass)](https://neon.com/postgresql/postgresql-administration/postgresql-password-file-pgpass)
- [Terminate Backend Connections](https://neon.com/postgresql/postgresql-administration/postgresql-pg_terminate_backend)
- [Uninstall PostgreSQL on Ubuntu](https://neon.com/postgresql/postgresql-administration/uninstall-postgresql-ubuntu)
