Changes

Jump to navigation Jump to search
1,109 bytes added ,  06:31, 22 August 2017
no edit summary
Line 63: Line 63:  
02:39:35: Error: ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
 
02:39:35: Error: ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
 
SUGERENCIA:  Use the same encoding as in the template database, or use template0 as template.
 
SUGERENCIA:  Use the same encoding as in the template database, or use template0 as template.
 +
 +
 +
== 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.
 +
 +
All the commands are executed as the postgres privileged user.
 +
Create the user
 +
 +
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
 +
Enter name of role to add: username
 +
Shall the new role be a superuser? (y/n) n
 +
Shall the new role be allowed to create databases? (y/n) n
 +
Shall the new role be allowed to create more new roles? (y/n) n
 +
CREATE ROLE
 +
postgres@hostname:~$
 +
Create the DB
 +
 +
Use the createdb command to create the database :
 +
 +
postgres@hostname:~$ createdb databasename
 +
CREATE DATABASE
 +
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 :
 +
 +
postgres@hostname:~$ psql
 +
postgres=# alter user username with encrypted password 'password';
 +
ALTER ROLE
 +
postgres=# grant all privileges on database databasename to username;
 +
 +
GRANT
 +
postgres@hostname:~$
    
Fix:
 
Fix:

Navigation menu