PostGre Utwórz użytkownika

#!/usr/bin/env bash
# to execute, open a terminal in directory and run chmod +x <filename>.sh

user="{user name}"
database="{database name}"
args="--host=localhost --dbname=$database --username=$user"

echo -e "Creating user $user.....\n"
sudo -u postgres createuser --createdb --pwprompt $user
echo -e "User Created!\n"

echo -e "Creating database $database.....\n"
sudo -u postgres createdb --owner=$user $database
echo -e "Database Created!\n"
echo -e "Restarting server and starting psql....\n"
sudo service postgresql restart

psql $args
Maou Shimazu