Skip to content

Instantly share code, notes, and snippets.

@ysdede
Created March 29, 2023 15:53
Show Gist options
  • Save ysdede/403ac8eab6f082739bc8c08b093b3135 to your computer and use it in GitHub Desktop.
Save ysdede/403ac8eab6f082739bc8c08b093b3135 to your computer and use it in GitHub Desktop.
Postgresql create/setup databases using the command line
Linux shell:
```bash
sudo -u postgres psql -c "CREATE DATABASE optuna_db;"
sudo -u postgres psql -c "CREATE USER optuna_user WITH PASSWORD 'password';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE optuna_db to optuna_user;"
```
Window:
```cmd
psql -U postgres -W -c "CREATE DATABASE optuna_db;"
psql -U postgres -W -c "CREATE USER optuna_user WITH PASSWORD 'password';"
psql -U postgres -W -c "GRANT ALL PRIVILEGES ON DATABASE optuna_db to optuna_user;"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment