Sysadmin:Psql-setup
Jump to navigation
Jump to search
Creating account + database
To create new accounts and databases on the postgres sql server, change directory to "/var/lib/postgresql".
cd /var/lib/postgresql
Note: Make sure to use the sysadmin account for this, as it has a role in PSQL set up already (root does not).
Inside this directory there is a script file named: "create-database.sh". You can create a new user and database by using this script + username:
./create-database.sh {username}
Where {username} is the user's username.
This script will make a new postgres user called {username} and a new database called {username_db}.
You can access this database by using the psql command:
psql -d {username_db}
where {username} is the user's username.