Created
September 6, 2017 15:31
-
-
Save Dylan0203/e6db3e61dd9b4f792d0ea28705d4d244 to your computer and use it in GitHub Desktop.
Revisions
-
Dylan0203 created this gist
Sep 6, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e https://www.cyberciti.biz/faq/howto-add-postgresql-user-account/ ``` $ sudo -u postgres psql ``` Create User ``` $ sudo -u postgres createuser <username> ``` Creating Database ``` $ sudo -u postgres createdb <dbname> ``` Giving the user a password ``` $ sudo -u postgres psql psql=# alter user <username> with encrypted password '<password>'; ``` Granting privileges on database ``` psql=# grant all privileges on database <dbname> to <username> ; ```