Guest User

Untitled

a guest
Feb 17th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $ su - postgres
  2. $ psql template1
  3. template1=# CREATE USER tester WITH PASSWORD 'test_password';
  4. template1=# GRANT ALL PRIVILEGES ON DATABASE "test_database" to tester;
  5. template1=# q
  6.  
  7. $connString = 'port=5432 dbname=test_database user=tester password=test_password';
  8. $connHandler = pg_connect($connString);
  9. echo 'Connected to '.pg_dbname($connHandler);
  10.  
  11. CREATE USER name [ [ WITH ] option [ ... ] ]
  12.  
  13. where option can be:
  14.  
  15. SUPERUSER | NOSUPERUSER
  16. | CREATEDB | NOCREATEDB
  17. | CREATEROLE | NOCREATEROLE
  18. | CREATEUSER | NOCREATEUSER
  19. | INHERIT | NOINHERIT
  20. | LOGIN | NOLOGIN
  21. | REPLICATION | NOREPLICATION
  22. | CONNECTION LIMIT connlimit
  23. | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
  24. | VALID UNTIL 'timestamp'
  25. | IN ROLE role_name [, ...]
  26. | IN GROUP role_name [, ...]
  27. | ROLE role_name [, ...]
  28. | ADMIN role_name [, ...]
  29. | USER role_name [, ...]
  30. | SYSID uid
  31.  
  32. grant all privileges on database db_name to someuser;
Add Comment
Please, Sign In to add comment