Skip to content

Commit

Permalink
docs: add database creation tips (#449)
Browse files Browse the repository at this point in the history
添加创建数据库的提示。

Fixes #336

```release-note
None
```
  • Loading branch information
ruibaby authored Oct 28, 2024
1 parent e4edfed commit 5ef6bc2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 17 deletions.
8 changes: 8 additions & 0 deletions docs/getting-started/install/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ import DockerRegistryList from "./slots/_docker-registry-list.md"
# 端口号 默认8090
- --server.port=8090
```

:::info
使用外部数据库时,需要提前手动创建好数据库,以 MySQL 为例:

```sql
create database halo character set utf8mb4 collate utf8mb4_bin;
```
:::
</TabItem>
</Tabs>

Expand Down
21 changes: 13 additions & 8 deletions docs/getting-started/install/jar-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,31 @@ title: 使用 JAR 文件部署
数据库配置说明:
| 参数名 | 描述 |
|----------------------------|-------------------------------------------------------|
| `spring.r2dbc.url` | 数据库连接地址,详细可查阅下方的 `配置对应关系` |
| `spring.r2dbc.username` | 数据库用户名 |
| `spring.r2dbc.password` | 数据库密码 |
| 参数名 | 描述 |
| -------------------------- | ----------------------------------------------------------- |
| `spring.r2dbc.url` | 数据库连接地址,详细可查阅下方的 `配置对应关系` |
| `spring.r2dbc.username` | 数据库用户名 |
| `spring.r2dbc.password` | 数据库密码 |
| `spring.sql.init.platform` | 数据库平台名称,支持 `postgresql`、`mysql`、`mariadb`、`h2` |

配置对应关系:

| 链接方式 | 链接地址格式 | `spring.sql.init.platform` |
|-------------|------------------------------------------------------------------------------------|----------------------------|
| ----------- | ---------------------------------------------------------------------------------- | -------------------------- |
| PostgreSQL | `r2dbc:pool:postgresql://{HOST}:{PORT}/{DATABASE}` | postgresql |
| MySQL | `r2dbc:pool:mysql://{HOST}:{PORT}/{DATABASE}` | mysql |
| MariaDB | `r2dbc:pool:mariadb://{HOST}:{PORT}/{DATABASE}` | mariadb |
| MariaDB | `r2dbc:pool:mariadb://{HOST}:{PORT}/{DATABASE}` | mariadb |
| H2 Database | `r2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSE` | h2 |

:::info
- HOST:数据库服务地址,如 `localhost`
- PORT:数据库服务端口,如 `3306`
- DATABASE:数据库名称,如 `halo`,需要提前创建
- DATABASE:数据库名称,如 `halo`,需要提前创建,以 MySQL 为例:

```sql
create database halo character set utf8mb4 collate utf8mb4_bin;
```

:::

:::warning
Expand Down
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const config = {
prism: {
theme: darkCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["java"],
additionalLanguages: ["java","sql"],
},
zoom: {
selector: ".markdown :not(a) > img",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ import DockerRegistryList from "./slots/_docker-registry-list.md"
# 端口号 默认8090
- --server.port=8090
```

:::info
使用外部数据库时,需要提前手动创建好数据库,以 MySQL 为例:

```sql
create database halo character set utf8mb4 collate utf8mb4_bin;
```
:::
</TabItem>
</Tabs>

Expand Down
21 changes: 13 additions & 8 deletions versioned_docs/version-2.20/getting-started/install/jar-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,31 @@ title: 使用 JAR 文件部署
数据库配置说明:
| 参数名 | 描述 |
|----------------------------|-------------------------------------------------------|
| `spring.r2dbc.url` | 数据库连接地址,详细可查阅下方的 `配置对应关系` |
| `spring.r2dbc.username` | 数据库用户名 |
| `spring.r2dbc.password` | 数据库密码 |
| 参数名 | 描述 |
| -------------------------- | ----------------------------------------------------------- |
| `spring.r2dbc.url` | 数据库连接地址,详细可查阅下方的 `配置对应关系` |
| `spring.r2dbc.username` | 数据库用户名 |
| `spring.r2dbc.password` | 数据库密码 |
| `spring.sql.init.platform` | 数据库平台名称,支持 `postgresql`、`mysql`、`mariadb`、`h2` |

配置对应关系:

| 链接方式 | 链接地址格式 | `spring.sql.init.platform` |
|-------------|------------------------------------------------------------------------------------|----------------------------|
| ----------- | ---------------------------------------------------------------------------------- | -------------------------- |
| PostgreSQL | `r2dbc:pool:postgresql://{HOST}:{PORT}/{DATABASE}` | postgresql |
| MySQL | `r2dbc:pool:mysql://{HOST}:{PORT}/{DATABASE}` | mysql |
| MariaDB | `r2dbc:pool:mariadb://{HOST}:{PORT}/{DATABASE}` | mariadb |
| MariaDB | `r2dbc:pool:mariadb://{HOST}:{PORT}/{DATABASE}` | mariadb |
| H2 Database | `r2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSE` | h2 |

:::info
- HOST:数据库服务地址,如 `localhost`
- PORT:数据库服务端口,如 `3306`
- DATABASE:数据库名称,如 `halo`,需要提前创建
- DATABASE:数据库名称,如 `halo`,需要提前创建,以 MySQL 为例:

```sql
create database halo character set utf8mb4 collate utf8mb4_bin;
```

:::

:::warning
Expand Down

0 comments on commit 5ef6bc2

Please sign in to comment.