浏览代码

Reviews PostgreSQL configuration documentation

Adrien Panay 7 年前
父节点
当前提交
1ebf82ef21
共有 1 个文件被更改,包括 21 次插入0 次删除
  1. 21 0
      doc/database.md

+ 21 - 0
doc/database.md 查看文件

1
 
1
 
2
+
2
 # Database #
3
 # Database #
3
 
4
 
4
 *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.*
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
 
35
 
35
 ##### With `psql`, the `PostgreSQL` interactive terminal
36
 ##### With `psql`, the `PostgreSQL` interactive terminal
36
 
37
 
38
+Create user and database:
39
+
37
     sudo --user=postgres psql \
40
     sudo --user=postgres psql \
38
          --command="CREATE USER tracimuser WITH PASSWORD 'tracimpassword';" \
41
          --command="CREATE USER tracimuser WITH PASSWORD 'tracimpassword';" \
39
          --command="CREATE DATABASE tracimdb OWNER tracimuser;"
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
 [//]: # (The following lines are only necessary to fix permissions on an existing database:)
61
 [//]: # (The following lines are only necessary to fix permissions on an existing database:)
41
 [//]: # (    sudo --user=postgres psql \)
62
 [//]: # (    sudo --user=postgres psql \)
42
 [//]: # (         --dbname=tracimdb \)
63
 [//]: # (         --dbname=tracimdb \)