xxxxxxxxxx
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
xxxxxxxxxx
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
xxxxxxxxxx
# To create a new PostgreSQL database while using psql
CREATE DATABASE nameOfDatabase;
xxxxxxxxxx
sudo -u postgres psql
CREATE DATABASE django_db;
CREATE USER django WITH PASSWORD 'password';
ALTER ROLE django SET client_encoding TO 'utf8';
ALTER ROLE django SET default_transaction_isolation TO 'read committed';
ALTER ROLE django SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE django_db TO django;
\q
xxxxxxxxxx
createdb -h localhost -p 5432 -U postgres testdb
password ******
xxxxxxxxxx
docker run --name postgres-db -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres