Skip to content

Instantly share code, notes, and snippets.

@ssrlive
Last active February 4, 2023 02:52
Show Gist options
  • Save ssrlive/f1917b23e8d9a19a260503028e82946e to your computer and use it in GitHub Desktop.
Save ssrlive/f1917b23e8d9a19a260503028e82946e to your computer and use it in GitHub Desktop.
Getting Started with PostgreSQL on macOS

Getting Started with PostgreSQL on macOS

goodgeek@mypc ~ % /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

goodgeek@mypc ~ % brew install postgresql

goodgeek@mypc ~ % brew services restart postgresql

goodgeek@mypc ~ % psql postgres
psql (14.2)
Type "help" for help.

postgres=# \c
You are now connected to database "postgres" as user "goodgeek".

postgres=# CREATE ROLE postgres WITH LOGIN CREATEDB CREATEROLE superuser PASSWORD 'postgres';
CREATE ROLE

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 goodgeek  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 postgres  | Superuser, Create role, Create DB                          | {}

postgres=# \q

goodgeek@mypc ~ %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment