Created
March 29, 2023 15:53
-
-
Save ysdede/403ac8eab6f082739bc8c08b093b3135 to your computer and use it in GitHub Desktop.
Postgresql create/setup databases using the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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