Skip to content

Instantly share code, notes, and snippets.

@pablodz
Created July 1, 2020 20:35
Show Gist options
  • Select an option

  • Save pablodz/1a0423b2132e15b9d982d0ffeeae9720 to your computer and use it in GitHub Desktop.

Select an option

Save pablodz/1a0423b2132e15b9d982d0ffeeae9720 to your computer and use it in GitHub Desktop.
# Check postgres sql
sudo -u postgres psql -c "SELECT version();"
# Creating a new user in postgres
sudo su - postgres -c "createuser your_username"
# Creating the database
sudo su - postgres -c "createdb your_database_name"
# Enter postgres line command
sudo -u postgres psql
# Set the privileges of the user for the database
# Maybe this part need to we copy&paste separetely
grant all privileges on database your_database_name to your_username;
\q
# \q will end postgresql command line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment