Answer the question
In order to leave comments, you need to log in
How to log in as a user?
I installed postgres9. Further I work with it through the command line. My OS is linux mint 18.
After installing postgres, the postgres user was created in the OS, as indicated by the entry in /etc/passwd:
postgres:x:123:132:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash
sudo -u postgres psql
postgres=# CREATE USER user1 WITH PASSWORD 'qwerty1';
CREATE ROLE
postgres=# CREATE DATABASE database1;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE database1 to user1;
GRANT
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
database1 | postgres | UTF8 | ru_RU.UTF-8 | ru_RU.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | user1=CTc/postgres
postgres=# \q
(ven) [email protected] ~/.MINT18/code/python/project0/ven/bin $ sudo -u user1 psql
sudo: неизвестный пользователь: user1
sudo: не удаётся инициализировать модуль политики
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question