You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/doc/installation/database-preparation.en-us.md
+23-12Lines changed: 23 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,20 @@ Note: All steps below requires that the database engine of your choice is instal
21
21
22
22
## MySQL
23
23
24
-
1. On database instance, login to database console as root:
24
+
1. For remote database setup, you will need to make MySQL listen to your IP address. Edit `bind-address` option on `/etc/mysql/my.cnf` on database instance to:
25
+
26
+
```ini
27
+
bind-address = 203.0.113.3
28
+
```
29
+
2. On database instance, login to database console as root:
25
30
26
31
```
27
32
mysql -u root -p
28
33
```
29
34
30
35
Enter the password as prompted.
31
36
32
-
2. Create database user which will be used by Gitea, authenticated by password. This example uses `'gitea'` as password. Please use a secure password for your instance.
37
+
3. Create database user which will be used by Gitea, authenticated by password. This example uses `'gitea'` as password. Please use a secure password for your instance.
33
38
34
39
For local database:
35
40
@@ -49,15 +54,15 @@ Note: All steps below requires that the database engine of your choice is instal
49
54
50
55
Replace username and password above as appropriate.
51
56
52
-
3. Create database with UTF-8 charset and collation. Make sure to use `utf8mb4` charset instead of `utf8` as the former supports all Unicode characters (including emojis) beyond *Basic Multilingual Plane*. Also, collation chosen depending on your expected content. When in doubt, use either `unicode_ci` or `general_ci`.
57
+
4. Create database with UTF-8 charset and collation. Make sure to use `utf8mb4` charset instead of `utf8` as the former supports all Unicode characters (including emojis) beyond *Basic Multilingual Plane*. Also, collation chosen depending on your expected content. When in doubt, use either `unicode_ci` or `general_ci`.
53
58
54
59
```sql
55
60
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
56
61
```
57
62
58
63
Replace database name as appropriate.
59
64
60
-
4. Grant all privileges on the database to database user created above.
65
+
5. Grant all privileges on the database to database user created above.
61
66
62
67
For local database:
63
68
@@ -73,9 +78,9 @@ Note: All steps below requires that the database engine of your choice is instal
73
78
FLUSH PRIVILEGES;
74
79
```
75
80
76
-
5. Quit from database console by `exit`.
81
+
6. Quit from database console by `exit`.
77
82
78
-
6. On your Gitea server, test connection to the database:
83
+
7. On your Gitea server, test connection to the database:
79
84
80
85
```
81
86
mysql -u gitea -h 203.0.113.3 -p giteadb
@@ -87,37 +92,43 @@ Note: All steps below requires that the database engine of your choice is instal
87
92
88
93
## PostgreSQL
89
94
90
-
1. PostgreSQL uses `md5` challenge-response encryption scheme for password authentication by default. Nowadays this scheme is not considered secure anymore. Use SCRAM-SHA-256 scheme instead by editing the `postgresql.conf` configuration file on the database server to:
95
+
1. For remote database setup, configure PostgreSQL on database instance to listen to your IP address by editing `listen_addresses` on `postgresql.conf` to:
96
+
97
+
```ini
98
+
listen_addresses = 'localhost, 203.0.113.3'
99
+
```
100
+
101
+
2. PostgreSQL uses `md5` challenge-response encryption scheme for password authentication by default. Nowadays this scheme is not considered secure anymore. Use SCRAM-SHA-256 scheme instead by editing the `postgresql.conf` configuration file on the database server to:
91
102
92
103
```ini
93
104
password_encryption = scram-sha-256
94
105
```
95
106
96
107
Restart PostgreSQL to apply the setting.
97
108
98
-
2. On the database server, login to the database console as superuser:
109
+
3. On the database server, login to the database console as superuser:
99
110
100
111
```
101
112
su -c "psql" - postgres
102
113
```
103
114
104
-
3. Create database user (role in PostgreSQL terms) with login privilege and password. Please use a secure, strong password instead of `'gitea'` below:
115
+
4. Create database user (role in PostgreSQL terms) with login privilege and password. Please use a secure, strong password instead of `'gitea'` below:
105
116
106
117
```sql
107
118
CREATE ROLE gitea WITH LOGIN PASSWORD 'gitea';
108
119
```
109
120
110
121
Replace username and password as appropriate.
111
122
112
-
4. Create database with UTF-8 charset and owned by the database user created earlier. Any `libc` collations can be specified with `LC_COLLATE` and `LC_CTYPE` parameter, depending on expected content:
123
+
5. Create database with UTF-8 charset and owned by the database user created earlier. Any `libc` collations can be specified with `LC_COLLATE` and `LC_CTYPE` parameter, depending on expected content:
0 commit comments