Changes

Jump to navigation Jump to search
499 bytes removed ,  18:37, 25 August 2017
Line 66: Line 66:     
== Create user, database and password ==
 
== Create user, database and password ==
The following step-by-step will let you create a user, a database (DB) and grant full access to the user to this DB.<br />
+
* Create the user<br />
<br />
+
postgres@hostname:~$ createuser
 
  −
 
  −
All the commands are executed as the postgres privileged user.
  −
Create the user<br />
  −
<br />
  −
 
  −
 
  −
For this, you use the command createuser which is provides with the postgreSQL package. Then answer the questions as you see fit :<br />
  −
<br />
  −
 
     −
postgres@hostname:~$ createuser
   
Enter name of role to add: username
 
Enter name of role to add: username
 
Shall the new role be a superuser? (y/n) n
 
Shall the new role be a superuser? (y/n) n
Line 85: Line 74:  
Shall the new role be allowed to create more new roles? (y/n) n
 
Shall the new role be allowed to create more new roles? (y/n) n
 
CREATE ROLE
 
CREATE ROLE
postgres@hostname:~$
  −
Create the DB
  −
  −
Use the createdb command to create the database :
      +
* Create the DB
 
  postgres@hostname:~$ createdb databasename
 
  postgres@hostname:~$ createdb databasename
 
CREATE DATABASE
 
CREATE DATABASE
 
postgres@hostname:~$
 
postgres@hostname:~$
Grand access for the user to the DB
  −
  −
And last, using the psql command, set a password for the user and grant accesses :
      +
* Grant access for the user to the DB
 
  postgres@hostname:~$ psql
 
  postgres@hostname:~$ psql
 
  postgres=# alter user username with encrypted password 'password';
 
  postgres=# alter user username with encrypted password 'password';

Navigation menu