Skip to content

Instantly share code, notes, and snippets.

@guoqiao
Created December 28, 2022 09:54
Show Gist options
  • Save guoqiao/d02eb479d47cf714d45f5a33861f829c to your computer and use it in GitHub Desktop.
Save guoqiao/d02eb479d47cf714d45f5a33861f829c to your computer and use it in GitHub Desktop.
PostgreSQL cheatsheet

create db and user:

app=$1

dbuser=$app
dbname=$app

sudo su --login postgres << EOF

createuser --echo ${dbuser};
createdb   --echo --owner ${dbuser} ${dbname};

EOF

reload:

sudo su -l postgres -c "pg_ctl reload"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment