| 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. | + | 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 /> |
| | + | <br /> |
| | + | |
| | | | |
| | All the commands are executed as the postgres privileged user. | | All the commands are executed as the postgres privileged user. |
| − | Create the 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 /> |
| | | | |
| − | For this, you use the command createuser which is provides with the postgreSQL package. Then answer the questions as you see fit :
| |
| | | | |
| − | postgres@hostname:~$ createuser | + | 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 84: |
Line 90: |
| | Use the createdb command to create the database : | | Use the createdb command to create the database : |
| | | | |
| − | postgres@hostname:~$ createdb databasename | + | postgres@hostname:~$ createdb databasename |
| | CREATE DATABASE | | CREATE DATABASE |
| | postgres@hostname:~$ | | postgres@hostname:~$ |
| Line 91: |
Line 97: |
| | And last, using the psql command, set a password for the user and grant accesses : | | And last, using the psql command, set a password for the user and grant accesses : |
| | | | |
| − | postgres@hostname:~$ psql | + | postgres@hostname:~$ psql |
| − | postgres=# alter user username with encrypted password 'password'; | + | postgres=# alter user username with encrypted password 'password'; |
| | ALTER ROLE | | ALTER ROLE |
| | postgres=# grant all privileges on database databasename to username; | | postgres=# grant all privileges on database databasename to username; |