Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions mintlify/get-started/self-host/external-postgres.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,47 @@ PostgreSQL 14 or above.

### Database

The connecting `database` must be created in advance. **The database should use UTF-8 for encoding. UTF-8 encoding is mandatory across the entire system**.
Create a database named `bytebase` with UTF-8 encoding. UTF-8 encoding is required for proper system operation.

### User

Create a user `bytebase` with one of the following privilege levels:

#### Option 1: Superuser
<Note>
This option is not available on managed database services like AWS RDS or Google Cloud SQL.
</Note>

For Cloud Database such as AWS RDS, GCP Cloud SQL, ensure that the `user` either owns the schema (`public`) and `database`, or has the necessary privileges to access them.
Grant PostgreSQL superuser privileges:
```sql
ALTER ROLE bytebase SUPERUSER;
```

- `ALTER DATABASE database OWNER TO bytebase;`
- `ALTER SCHEMA public OWNER TO bytebase;`
#### Option 2: Database Owner
Make the user own the database:
```sql
ALTER DATABASE bytebase OWNER TO bytebase;
```

</Note>
#### Option 3: Schema Create Privilege
Grant CREATE privilege on the public schema:
```sql
GRANT CREATE ON SCHEMA public TO bytebase;
```

The connecting `user` must have all the following database privileges:

- SELECT
- INSERT
- UPDATE
- DELETE
- TRUNCATE
- REFERENCES
- TRIGGER
- CREATE
- CONNECT
- TEMPORARY
- EXECUTE
- USAGE
#### Option 4: Database Owner Role
Grant the db_owner role to the user:
```sql
GRANT db_owner TO bytebase;
```

### PG_URL String Format

**Supported format:**

_postgresql://\<\<user>>:\<\<secret>>@\<\<host>>:\<\<port>>/\<\<database>\>_
Bytebase uses the standard PostgreSQL connection URI format. See the [official PostgreSQL documentation](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS) for complete details.

**Example:**

_postgresql://bytebase:z\*3kd2@example.com:5432/meta_
_postgresql://bytebase:your_password@example.com:5432/bytebase_

## Running with Docker

Expand Down