Skip to content

Instantly share code, notes, and snippets.

@doevelopper
Created October 10, 2017 22:56
Show Gist options
  • Save doevelopper/768fbba1ca42dec7236efb663d6ac187 to your computer and use it in GitHub Desktop.
Save doevelopper/768fbba1ca42dec7236efb663d6ac187 to your computer and use it in GitHub Desktop.
-- from the command-line:
createdb -E UNICODE -l C -T template0 jiradb
-- CREATE DATABASE jiradb WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;
--
-- https://www.postgresql.org/docs/9.6/static/app-createuser.html
-- $> sudo su - postgres
-- $> createuser --interactive --pwprompt crowd
-- >n
-- >y
-- >n
-- $> logout
-- $> sudo su - crowd
-- $> createdb -E UNICODE -l C -T template0 crowddb
--List of databases
--postgres@devsecops:~$ psql -U postgres -l
# sudo -u postgres bash -c "psql -c \"CREATE USER crowdid WITH PASSWORD 'happyman';\""
# sudo -u postgres bash -c "psql -c \"CREATE USER crowdid WITH PASSWORD 'happyman';\""
# deleting a user
# sudo -u postgres bash -c "psql -c \"DROP USER crowd;\""
# Grant access to user not created in the host
# postgres=# grant all privileges on database databasename to username;
# grant all privileges on database crowdiddb to crowdid;
# sudo -u postgres bash -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE \"crowdiddb\" to crowdid\"";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment