Installation and Database Management in PostgreSQL

Slide Note
Embed
Share

"Discover how to install PostgreSQL on Windows and Mac OS, set up a database using pgAdmin or Command Line, and interact with PostgreSQL through shell commands. Learn step-by-step instructions for installation and database creation to kickstart your PostgreSQL journey."


Uploaded on Apr 16, 2024 | 7 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. PostgreSQL Installation CS331E Elements of Software Engineering II

  2. Windows Installation Go to https://www.postgresql.org/download/windows/ Click on Download the installer and run it Choose PostgreSQL Version and Operating System I chose version 15.6 I chose Windows x86-64 Specify an admin password (write it down, you ll need it later on) Use the default port Upon finishing the installation, you may uncheck "Launch Stack Builder at exit" Make sure that Postgres is successfully installed, search for "pgadmin" and click it

  3. Creating a Database You can interact with PostgreSQL by using either pgadmin or Command line (git bash) Note: you must update the path in the system environment variables by adding the path to PostgreSQL on your local machine. On my machine, the path is as follows: C:\Program Files\PostgreSQL\15\bin

  4. Creating a Database Turn on the interaction with PostgreSQL Create a Database

  5. Turn on the interaction with PostgreSQL Interacting with PostgreSQL via Command line. Run Git Bash and at the prompt type in the following. $ psql -U postgres -h localhost Password for user postgres: psql (15.6, server 10.16) WARNING: Console code page (437) differs from Windows code page (1252) 8-bit characters might not work correctly. See psql reference page "Notes for Windows users" for details. Type "help" for help. postgres=#

  6. Create a Database At the psql prompt, create the database bookdb by typing in the following command. postgres=# create database bookdb; CREATE DATABASE

  7. Mac OS Installation Download postgres.app http://postgresapp.com Run the application and you have a PostgreSQL server running

  8. Create a Database Open Postgres.app Click on "Open psql" and a terminal window will open In the window type in the following. abc=# create database bookdb;

  9. Basic PostgreSQL Shell Commands Command \l \c dbname Ouput list all databases connect to the database dbname \dt \d table_name list all tables describe the table table_name \q \password quit psql Change password

More Related Content