Installing and Setting Up PostgreSQL for Windows and Mac OS

Slide Note
Embed
Share

Learn how to install PostgreSQL on Windows and Mac OS, set up a superuser password, create a database using pgAdmin or Command Line, and execute basic shell commands for database management. This guide provides step-by-step instructions for a seamless installation process.


Uploaded on Oct 06, 2024 | 1 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 CS373 Software Engineering

  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.7 I chose Windows x86-64 Specify a superuser 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 for Windows users: you must update the path in the system environment variables by adding the path to PostgreSQL on your local machine, e.g., C:\Program Files\PostgreSQL\15\bin Note: your path might be different. Check where PostgreSQL was installed.

  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.7) 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 create database db; Create table tb(att type, ) drop database db; drop table tb; quit psql create the database db create the table tb with the attribute att. remove the database db remove the table tb

Related


More Related Content