postgres login with user code example
Example 1: how to connect postgres user password using command line
sudo -u postgres psql postgres
Example 2: how to login using a particular user postrges
psql -d mydb -U myuser -W
psql -h myhost -d mydb -U myuser -W
Example 3: create new user in postgres
CREATE USER visualscrapy WITH PASSWORD '123456';
# it will create the new user in postgres
Example 4: useradd postgres
sudo -u postgres psqlpostgres=# create database mydb;postgres=# create user myuser with encrypted password 'mypass';postgres=# grant all privileges on database mydb to myuser;