Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn PostgreSQL

You're reading from   Learn PostgreSQL Build and manage high-performance database solutions using PostgreSQL 12 and 13

Arrow left icon
Product type Paperback
Published in Oct 2020
Publisher Packt
ISBN-13 9781838985288
Length 650 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Enrico Pirozzi Enrico Pirozzi
Author Profile Icon Enrico Pirozzi
Enrico Pirozzi
Luca Ferrari Luca Ferrari
Author Profile Icon Luca Ferrari
Luca Ferrari
Arrow right icon
View More author details
Toc

Table of Contents (27) Chapters Close

Preface 1. Section 1: Getting Started
2. Introduction to PostgreSQL FREE CHAPTER 3. Getting to Know Your Cluster 4. Managing Users and Connections 5. Section 2: Interacting with the Database
6. Basic Statements 7. Advanced Statements 8. Window Functions 9. Server-Side Programming 10. Triggers and Rules 11. Partitioning 12. Section 3: Administering the Cluster
13. Users, Roles, and Database Security 14. Transactions, MVCC, WALs, and Checkpoints 15. Extending the Database - the Extension Ecosystem 16. Indexes and Performance Optimization 17. Logging and Auditing 18. Backup and Restore 19. Configuration and Monitoring 20. Section 4: Replication
21. Physical Replication 22. Logical Replication 23. Section 5: The PostegreSQL Ecosystem
24. Useful Tools and Extensions 25. Toward PostgreSQL 13 26. Other Books You May Enjoy

Setting up our developing environment

At this point in the book, we have learned how to install PostgreSQL and how to configure users. Let's now see how to connect to our database. In the next four steps, we will see how easy it is to do this:

  1. Start by connecting to your psql environment:
postgres@pgdev:~$ psql 
psql (12.1 (Debian 12.1-1.pgdg100+1))
Type "help" for help.
postgres=#
  1. Next, switch on the expanded mode using the \x command:
postgres=# \x
Expanded display is on.
  1. Then list all the databases that are present in the cluster:
postgres=# \l
List of databases
-[ RECORD 1 ]-----+----------------------
Name | forumdb
Owner | postgres
Encoding | UTF8
Collate | en_US.UTF-8
Ctype | en_US.UTF-8
Access privileges |
  1. Finally, connect to the forumdb database:
postgres=# \c forumdb 
You are now connected to database "forumdb" as user "postgres".
forumdb=#

Now, that we have finished setting up our developing...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime