Browse Source

Reviews PostgreSQL configuration documentation

Adrien Panay 7 years ago
parent
commit
1ebf82ef21
1 changed files with 21 additions and 0 deletions
  1. 21 0
      doc/database.md

+ 21 - 0
doc/database.md View File

@@ -1,4 +1,5 @@
1 1
 
2
+
2 3
 # Database #
3 4
 
4 5
 *Note: This page helps you setting up a **development** environment for `Tracim` and its ORM `SQLAlchemy` with `PostgreSQL` and `MySQL`. To set up a **production** environment, changing default database name, database user name and moreover its password is mandatory.*
@@ -34,9 +35,29 @@ If you changed the file, reload `PostgreSQL`:
34 35
 
35 36
 ##### With `psql`, the `PostgreSQL` interactive terminal
36 37
 
38
+Create user and database:
39
+
37 40
     sudo --user=postgres psql \
38 41
          --command="CREATE USER tracimuser WITH PASSWORD 'tracimpassword';" \
39 42
          --command="CREATE DATABASE tracimdb OWNER tracimuser;"
43
+
44
+Test the database access:
45
+
46
+    psql --username=tracimuser --password --host=localhost --dbname=tracimdb \
47
+         --command="SELECT NOW();"
48
+
49
+Success output:
50
+
51
+                  now
52
+    -------------------------------
53
+    2017-08-25 15:46:41.105865+02
54
+    (1 ligne)
55
+
56
+Failure output:
57
+
58
+    psql: FATAL:  password authentication failed for user "tracimuser"
59
+    FATAL:  password authentication failed for user "tracimuser"
60
+
40 61
 [//]: # (The following lines are only necessary to fix permissions on an existing database:)
41 62
 [//]: # (    sudo --user=postgres psql \)
42 63
 [//]: # (         --dbname=tracimdb \)