Bladeren bron

Begins PostgreSQL setup review

Adrien Panay 7 jaren geleden
bovenliggende
commit
27e298e87d
1 gewijzigde bestanden met toevoegingen van 18 en 7 verwijderingen
  1. 18 7
      doc/database.md

+ 18 - 7
doc/database.md Bestand weergeven

@@ -32,7 +32,20 @@ If you changed the file, reload `PostgreSQL`:
32 32
 
33 33
 #### Creating a user and associated database ####
34 34
 
35
-You need a database and associated user/password. Tracim comes with `pgtool`, tool that will make this step easy:
35
+##### With `psql`, the `PostgreSQL` interactive terminal
36
+
37
+    sudo --user=postgres psql \
38
+         --command='CREATE USER tracimuser WITH PASSWORD tracimpassword;' \
39
+         --command='CREATE DATABASE tracimdb OWNER TO tracimuser;'
40
+[//]: # (The following lines should only be necessary to fix permissions on an existing database:)
41
+[//]: # (    sudo --user=postgres psql \)
42
+[//]: # (         --dbname=tracimdb \)
43
+[//]: # (         --command='GRANT ALL PRIVILEGES ON DATABASE tracimdb TO tracimuser;' \)
44
+[//]: # (         --command='GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO tracimuser;')
45
+
46
+##### With `pgtool`
47
+
48
+Tracim comes with `pgtool` to ease this step:
36 49
 
37 50
     ./bin/pgtool help
38 51
 
@@ -44,13 +57,11 @@ Run the following self explanatory commands:
44 57
     ./bin/pgtool grant_all_privileges tracimdb tracimuser
45 58
     exit
46 59
 
47
-#### Test the database access ####
48
-
49
-So, now you have a database and an associated user/password. A good habit is to test things before to use them, that's why we want to test the database access. This is easily done with Tracim `pgtool`:
60
+Test the database access:
50 61
 
51 62
     ./bin/pgtool test_connection tracimdb tracimuser tracimpassword 127.0.0.1
52 63
 
53
-The result is similar to the following :
64
+Success output:
54 65
 
55 66
     PG # CONNECT TO DATABASE
56 67
     ------------------------
@@ -63,7 +74,7 @@ The result is similar to the following :
63 74
      2014-11-10 09:40:23.306199+01
64 75
     (1 row)
65 76
 
66
-In case of failure, you would get something like this:
77
+Failure output:
67 78
 
68 79
     PG # CONNECT TO DATABASE
69 80
     ------------------------
@@ -75,7 +86,7 @@ In case of failure, you would get something like this:
75 86
     FATAL:  password authentication failed for user "bibi"
76 87
     ERRROR
77 88
 
78
-In this case, delete the user and database you previously created, using `pgtool`, and do it again. Do not forget to run the `grant_all_rights` command!
89
+In this case, delete the user and database you previously created using `pgtool`, and do it again.
79 90
 
80 91
 ## MySQL ##
81 92