How to list databases in PostgreSQL

Ads
 

How to list databases in PostgreSQL

Hi,

I want to connect to Postgresql database and see all the databases stored in the database. How to list databases in PostgreSQL?

View Answers

February 7, 2019 at 3:13 AM

Hi,

You can do all these with the psql prompt of postgresql.

change user to postgres

su - postgres

The open psql tool by typing psql on the console:

psql

Now you can list the database names with the '\l' command. Here is example of listing databases in postgresql database server. List databases on the server:

\l

Then connect to database with the command:

\c template1

Thanks


February 12, 2019 at 11:33 PM

Hi,

if you want to list all tables in then run following command in psql prompt:

\dt

This will list all the tables in the connected database.

Thanks

Ads









Related Tutorials/Questions & Answers:
Version of postgresql>postgresql dependency
List of Version of postgresql>postgresql dependency
Hibernate 4 Supported Databases List
Hibernate 4 Supported Databases List In this tutorial you will learn that how many databases are supported by Hibernate. You must be looking for the list... the list of Hibernate supported databases with the name of Dialect to be used
Advertisements
Artifacts of postgresql
List of Artifacts of postgresql maven depenency
Databases
Databases  how to add data dynamically into the database table?? i used back end is mysql....   1)form.jsp: <html> <form method="post" action="insertdata.jsp"> <table> <tr><td>Name:<
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql  i am working on a project... to know that how to query multiple databases(databases created in my mysql) so
Version of postgresql>pljava-public dependency
List of Version of postgresql>pljava-public dependency
Version of com.dripower>postgresql-async_2.11 dependency
List of Version of com.dripower>postgresql-async_2.11 dependency
Version of com.eventsourcing>eventsourcing-postgresql dependency
List of Version of com.eventsourcing>eventsourcing-postgresql dependency
Version of com.snacktrace>storm-postgresql dependency
List of Version of com.snacktrace>storm-postgresql dependency
Version of cocoon>cocoon-databases dependency
List of Version of cocoon>cocoon-databases dependency
Switch databases
Switch databases  How do you inter-change between relational databases without code changes
Video Tutorial: Hibernate 4 Supported Databases List
Hibernate 4 Supported Databases List Hibernate being an object relational... databases. Here, the list of Hibernate 4 was compiled which supports the MySQL... tutorial of "Hibernate 4 Supported Databases List": There are several tutorials
databases
databases
databases
databases
databases
How to list files in hadoop?
How to list files in hadoop?  Hi, I want to list the files from a directory in HDFS. How to list files in hadoop? Thanks   Hi, Hadoop... provides commands to interact with the HDFS. To list down all the file
How to view a list of MySQL users and their privileges?
How to view a list of MySQL users and their privileges?  Hi, How to view a list of MySQL users and their privileges? It want to view these two... many users and databases on production server then you can easily view list
connecting databases
connecting databases  I need to connect mysql on 2 or more remote pc'c. how can i giv the ip address for 2 or more systems. is it possible to connect to the required systems by user specifying the database and table name my
mysqldump all databases
mysqldump all databases  How to take the backup of complete data including all the databases in the MySQL Server? Is there one command to take...-databases > all_databases.sql Thanks
How to get a list of MySQL user accounts?
How to get a list of MySQL user accounts?  Hi, I have MySQL database and I created many users for different databases. I want to see the names of all the users. How to get a list of MySQL user accounts? Thanks   Hi
How to use List in velocity
How to use List in velocity       This Example shows you how to use List in velocity. ...;new VelocityContext();   context.put("stuList", list);  
Databases supported by Jdeveloper?
Databases supported by Jdeveloper?  I want to know what databases are supported by jdeveloper ?and any light database for jdeveloper
Maven Dependency postgresql >> 7.2
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version7.2 in your project
Maven Dependency postgresql >> 7.3
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version7.3 in your project
Maven Dependency postgresql >> 7.4-jdbc3
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version7.4-jdbc3 in your project
Maven Dependency postgresql >> 7.4.1-jdbc3
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version7.4.1-jdbc3 in your project
Maven Dependency postgresql >> 7.4.1
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version7.4.1 in your project
Maven Dependency postgresql >> 8.0-318.jdbc3
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version8.0-318.jdbc3 in your project
Maven Dependency postgresql >> 8.1-404.jdbc3
You should include the dependency code given in this page to add Maven Dependency of postgresql >> postgresql version8.1-404.jdbc3 in your project

Ads