postgresql-installation install-postgresql macos-postgresql ubuntu-postgresql windows-postgresql psql-setup database-installation postgresql-tutorial
Published on November 06, 2024By DeveloperBreeze
1. Install PostgreSQL on macOS
Using Homebrew:
- Update Homebrew:
brew update
- Install PostgreSQL:
brew install postgresql
- Start PostgreSQL:
brew services start postgresql
- Verify Installation:
psql --version
To Connect to PostgreSQL:
psql postgres
2. Install PostgreSQL on Ubuntu/Debian
- Update Package List:
sudo apt update
- Install PostgreSQL:
sudo apt install postgresql postgresql-contrib
- Check PostgreSQL Service:
PostgreSQL starts automatically; to check the status:
sudo systemctl status postgresql
- Verify Installation:
psql --version
To Connect to PostgreSQL:
sudo -u postgres psql
3. Install PostgreSQL on Windows
- Download Installer:
Go to the [PostgreSQL website](https://www.postgresql.org/download/windows/) and download the installer.
- Run the Installer:
- Launch the installer and follow the instructions.
- Select Command Line Tools during the installation process.
- Verify Installation:
After installation, open a Command Prompt and type:
psql --version
To Connect to PostgreSQL:
- Open the
psql
command line interface from the Start menu or use:
psql -U postgres
- Enter the password you set during installation.
4. Post-Installation Tips
- Create a Database:
CREATE DATABASE mydatabase;
- List Databases:
\l
- Connect to a Database:
\c mydatabase
- Exit psql:
\q
This guide should get PostgreSQL up and running on your system!
Comments
Please log in to leave a comment.