Skip to content

Instantly share code, notes, and snippets.

@1st
Last active April 3, 2025 11:53
Show Gist options
  • Save 1st/99a6dbea23c6335d3cec to your computer and use it in GitHub Desktop.
Save 1st/99a6dbea23c6335d3cec to your computer and use it in GitHub Desktop.

Revisions

  1. 1st revised this gist Apr 3, 2025. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    ### UPDATE: Use https://postgresapp.com that contains Universal build wih multiple Postgres engines

    # 0. install a Postgres

    # we use HomeBrew for this
  2. 1st revised this gist Oct 16, 2019. No changes.
  3. 1st revised this gist Oct 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@

    # 2. create new database

    # specify user that will access this database (created below)
    # specify user that will access this database (created above)
    createdb -O username dbname

    # 3. test connection
  4. 1st revised this gist Dec 9, 2015. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    # we use HomeBrew for this
    brew install postgres
    # init file structure for all databases
    initdb /usr/local/var/postgres

    # 1. create new user for a database

    @@ -10,8 +12,10 @@
    # 1.2. user with password
    createuser --pwprompt username

    # 2. create new database
    createdb -Ousername dbname
    # 2. create new database

    # specify user that will access this database (created below)
    createdb -O username dbname

    # 3. test connection

  5. 1st revised this gist Dec 9, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # 0. install a Postgres
    brew install postgres

    # we use HomeBrew for this
    brew install postgres

    # 1. create new user for a database

  6. 1st revised this gist Dec 9, 2015. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -3,17 +3,17 @@ brew install postgres

    # 1. create new user for a database

    # 1.1. user without password
    createuser username
    # 1.2. user with password
    createuser --pwprompt username
    # 1.1. user without password
    createuser username
    # 1.2. user with password
    createuser --pwprompt username

    # 2. create new database
    createdb -Ousername dbname
    # 2. create new database
    createdb -Ousername dbname

    # 3. test connection

    # 3.1. user without password
    psql -U username dbname
    # 3.2. user with password
    psql -U username -W dbname
    # 3.1. user without password
    psql -U username dbname
    # 3.2. user with password
    psql -U username -W dbname
  7. 1st revised this gist Dec 9, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    # 0. install a Postgres
    brew install postgres

    # 1. create new user for a database

    # 1.1. user without password
  8. 1st revised this gist Dec 9, 2015. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    # 1. create new user for a database

    # 1.1. user with password
    createuser --pwprompt username
    # 1.2. user without password
    # 1.1. user without password
    createuser username
    # 1.2. user with password
    createuser --pwprompt username

    # 2. create new database
    createdb -Ousername dbname

    # 3. test connection

    # 3.1. user with password
    psql -U username -W dbname
    # 3.2. user without password
    psql -U username dbname
    # 3.1. user without password
    psql -U username dbname
    # 3.2. user with password
    psql -U username -W dbname
  9. 1st revised this gist Dec 9, 2015. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions pgsql.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,16 @@
    ### 1. create new user for a database
    # 1. create new user for a database

    # 1.1. user with password
    createuser --pwprompt username
    # 1.2. user without password
    createuser username

    # create new database
    createdb -Ousername dbname
    # 2. create new database
    createdb -Ousername dbname

    # 3. test connection

    # 3.1. user with password
    psql -U username -W dbname
    # 3.2. user without password
    psql -U username dbname
  10. 1st renamed this gist Dec 9, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  11. 1st created this gist Dec 9, 2015.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    ### 1. create new user for a database

    # 1.1. user with password
    createuser --pwprompt username
    # 1.2. user without password
    createuser username

    # create new database
    createdb -Ousername dbname