Skip to content
Merged
Changes from 1 commit
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
46 changes: 22 additions & 24 deletions mintlify/get-started/self-host/external-postgres.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,41 @@ 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

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

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

- `ALTER DATABASE database OWNER TO bytebase;`
- `ALTER SCHEMA public OWNER TO bytebase;`
Grant PostgreSQL superuser privileges:
```sql
ALTER ROLE bytebase SUPERUSER;
```

</Note>
#### Option 2: Database Owner
Make the user own the database:
```sql
ALTER DATABASE bytebase OWNER 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 3: Schema Create Privilege
Grant CREATE privilege on the public schema:
```sql
GRANT CREATE ON SCHEMA public 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/bytebase_

## Running with Docker

Expand Down