|
@@ -47,6 +47,32 @@ DB_USER=your_username
|
|
|
DB_PASSWORD=your_password
|
|
|
```
|
|
|
|
|
|
+## 数据库初始化
|
|
|
+
|
|
|
+1. 创建数据库:
|
|
|
+```bash
|
|
|
+createdb -U postgres data_db
|
|
|
+```
|
|
|
+
|
|
|
+2. 导入数据库备份:
|
|
|
+```bash
|
|
|
+pg_restore -U postgres -d data_db soilgd.sql
|
|
|
+```
|
|
|
+
|
|
|
+3. 验证数据库连接:
|
|
|
+```bash
|
|
|
+psql -U postgres -d data_db -c "\dt"
|
|
|
+```
|
|
|
+
|
|
|
+4. 导出导入指定数据库
|
|
|
+```bash
|
|
|
+# 导出(生成可被pg_restore恢复的文件)
|
|
|
+pg_dump -U postgres -Fc data_db > soilgd.sql
|
|
|
+
|
|
|
+# 导入(恢复上面生成的文件)
|
|
|
+pg_restore -U postgres -d data_db soilgd.sql
|
|
|
+```
|
|
|
+
|
|
|
## 运行
|
|
|
|
|
|
1. 启动服务:
|