Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 514 Bytes

postgresql.md

File metadata and controls

25 lines (14 loc) · 514 Bytes

PostgreSQL

sudo -u postgres psql

CREATE DATABASE mydb;
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass';
GRANT ALL privileges on DATABASE mydb TO myuser;

switch to database \c mydb;

print database I'm currently using SELECT current_database();

granting SELECT right GRANT ALL ON ALL TABLES IN SCHEMA schema_name TO myuser;

grant rights to use sequences GRANT ALL ON ALL SEQUENCES IN SCHEMA schema_name TO myuser;

note: "schema_name" is most likely "public"