Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ su - postgres
- $ psql template1
- template1=# CREATE USER tester WITH PASSWORD 'test_password';
- template1=# GRANT ALL PRIVILEGES ON DATABASE "test_database" to tester;
- template1=# q
- $connString = 'port=5432 dbname=test_database user=tester password=test_password';
- $connHandler = pg_connect($connString);
- echo 'Connected to '.pg_dbname($connHandler);
- CREATE USER name [ [ WITH ] option [ ... ] ]
- where option can be:
- SUPERUSER | NOSUPERUSER
- | CREATEDB | NOCREATEDB
- | CREATEROLE | NOCREATEROLE
- | CREATEUSER | NOCREATEUSER
- | INHERIT | NOINHERIT
- | LOGIN | NOLOGIN
- | REPLICATION | NOREPLICATION
- | CONNECTION LIMIT connlimit
- | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
- | VALID UNTIL 'timestamp'
- | IN ROLE role_name [, ...]
- | IN GROUP role_name [, ...]
- | ROLE role_name [, ...]
- | ADMIN role_name [, ...]
- | USER role_name [, ...]
- | SYSID uid
- grant all privileges on database db_name to someuser;
Add Comment
Please, Sign In to add comment