Listing and Switching Databases in PostgreSQL
- How to Install PostgreSQL on Ubuntu 22.04
- Creating and Deleting a PostgreSQL Database on Ubuntu 16.04
- Listing and Switching Databases in PostgreSQL
PostgreSQL (pronounced "post-gress-Q-L") is a household name for open source relational database management systems. Its object-relational meaning that you’ll be able to use objects, classes in database schemas and the query language. As part of our PostgreSQL series, we’ll show you how to list and switch between databases quickly.
Pre-flight
Log into your Ubuntu VPS server
Step 1: Login to your Databasesu - postgres
Step 2: Enter the PostgreSQL environmentpsql
With the psql command, you’ll be greeted by its current version and command prompt.
psql (9.5.14)
Type "help" for help.
postgres=#
Step 3: List Your PostgreSQL databases
Often, you’ll need to switch from database to database, but first, we will list the available database in PostgreSQL
postgres=# \list
By default, PosgreSQL has 3 databases: postgres, template0 and template1
Step 4: Switching Between Databases in PostgreSQL
Switching between databases is another way of saying you are closing one connection and opening another. When you need to change between databases, you’ll use the “connect” command, which is conveniently shortened to \c, followed by the database name.
\connect dbname
Or:
\c dbname
Still need a little assistance?
Our Support personnel are standing by to assist with this or any other issue you may encounter when tackling a problem with PostgreSQL. Our knowledgeable admins are standing by to help 24 hours a day, 7 days a week!. Call our toll free line at 1.800.580.4985 or open a chat or ticket with us at support@liquidweb.com.
Video authored by Justin Palmer
Related Articles:
- How to Use Disk Quotas in Dedicated Linux Servers With cPanel
- How to Use Disk Quotas in Dedicated Linux Servers with Plesk
- Remove a MySQL User on Linux via Command Line
- Remove Permissions for a MySQL User on Linux via Command Line
- Grant Permissions to a MySQL User on Linux via Command Line
- Using MySQL Command Line to Create a User
About the Author: Justin Palmer
Justin Palmer is a professional application developer with Liquid Web
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
What Is WebP and What Makes it Different from Other Image Formats?
Read ArticleTop 10 Password Security Standards
Read ArticleTop 10 Password Security Standards
Read ArticleHow to Install MongoDB on AlmaLinux
Read ArticleHow to Use the WP Toolkit to Secure and Update WordPress
Read Article