A simply activity
- Installing PostgreSQL
$ sudo apt update
Then, install the Postgres package along with a -contrib package that adds some additional utilities and functionality:
$ sudo apt install postgresql postgresql-contrib
- Ensure that the server is running using the systemctl start command:
sudo systemctl start postgresql.service
- Switch over to the postgres account on your server by typing:
sudo -i -u postgres
- You can now access the PostgreSQL prompt immediately by typing:
psql
Exit out
of the PostgreSQL prompt by typing:
\q
create database <dbname>;
- check database list
\list
- how to delete database (
use semicolon must
)
drop database <dbname>;
- Create a new user with password (
use semicolon must
)
create user <username> with password 'pass';