Will & Skill Developers

Will & Skill Developers


Thoughts, snippets and ideas from the team at Will & Skill AB, Stockholm.

Faisal M
Author

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Share


Tags


avrt

Create a PostgreSQL user and grant access to database

PostgreSQL is a great database engine, especially when used with Django. In this simple tutorial we will Create a USER CREATE USER johnnybravo WITH PASSWORD 'b…

Faisal MFaisal M

PostgreSQL is a great database engine, especially when used with Django.

In this simple tutorial we will

  1. Create a USER

     CREATE USER johnnybravo WITH PASSWORD 'bulletproof';
    
  2. Create a DATABASE

     CREATE DATABASE johnnybase;
    
  3. Give the USER full access to the DATABASE

     GRANT ALL PRIVILEGES ON DATABASE johnnybase to johnnybravo;
    

That's it! Your terminal should look like

faisal@vps:~$ sudo su postgres
postgres@vps:~$ psql
psql (9.4.1)
Type "help" for help.

postgres=# CREATE USER johnnybravo WITH PASSWORD 'bulletproof';
CREATE ROLE
postgres=# CREATE DATABASE johnnybase;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE johnnybase to johnnybravo;
GRANT
postgres=# \q
Faisal M
Author

Faisal M

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

View Comments