Environment:A616567126 GPT WEB JAVA MySQL Database
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Data_Storage |
| Last Updated | 2026-10-13 18:00 GMT |
Overview
MySQL 8.0 database with MyBatis-Plus 3.5.3.1 ORM and Druid 1.2.16 connection pool, providing persistent storage for users, tasks, orders, and configuration.
Description
This environment provides the persistent data layer for GPT-WEB-JAVA. It uses MySQL 8.0 as the database (driver `com.mysql.cj.jdbc.Driver`), MyBatis-Plus 3.5.3.1 as the ORM framework with auto-filled audit fields, and Alibaba Druid 1.2.16 as the connection pool with SQL statistics monitoring. The database name is `intelligent_bot` with UTF-8 encoding and Asia/Shanghai timezone. Connection pool is configured with max 30 active connections, min 2 idle, and 60s max wait. SQL logging is enabled in all profiles via StdOutImpl.
Usage
Use this environment for all data persistence operations. Every service that reads or writes user accounts, GPT keys, MJ tasks, SD models, orders, payment configs, Discord accounts, email configs, system configs, and message logs requires this database.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Any OS supporting MySQL 8.0 | Linux recommended for production |
| Hardware | 2GB+ RAM for MySQL instance | Handles connection pool of 30 max active |
| Disk | 5GB+ for database growth | Images stored on filesystem, not DB |
| Network | MySQL accessible on configured host:port | Dev: 127.0.0.1:3306, Prod: 127.0.0.1:3307 |
Dependencies
System Packages
- `mysql-server` = 8.0.x
Java Packages (Maven)
- `mysql-connector-java` = 8.0.32
- `mybatis-plus-boot-starter` = 3.5.3.1
- `druid-spring-boot-starter` = 1.2.16
Credentials
The following must be configured in `application-dev.yml` or `application-prod.yml`:
- `spring.datasource.url`: JDBC connection URL (e.g., `jdbc:mysql://127.0.0.1:3306/intelligent_bot`)
- `spring.datasource.username`: Database user (dev: `root`, prod: `intelligent_bot`)
- `spring.datasource.password`: Database password
Quick Install
# MySQL dependency is declared in pom.xml:
# mysql-connector-java:8.0.32
# mybatis-plus-boot-starter:3.5.3.1
# druid-spring-boot-starter:1.2.16
# Ensure MySQL 8.0 is running and database exists:
mysql -u root -p -e "CREATE DATABASE intelligent_bot CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
Code Evidence
DataSource configuration from `application-dev.yml:2-7`:
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://127.0.0.1:3306/intelligent_bot?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&autoReconnect=true&failOverReadOnly=false
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
Connection pool tuning from `application-dev.yml:8-19`:
filters: stat
maxActive: 30
initialSize: 1
maxWait: 60000
minIdle: 2
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 25200000
validationQuery: select '1'
testWhileIdle: true
MyBatis-Plus configuration from `application.yml:22-25`:
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Public Key Retrieval is not allowed` | MySQL 8.0 uses caching_sha2_password | Add `allowPublicKeyRetrieval=true` to JDBC URL (already present) |
| `Communications link failure` | MySQL not running or unreachable | Verify MySQL is running on configured host:port |
| `Access denied for user` | Wrong credentials in application yml | Check `spring.datasource.username` and `password` |
| `Table 'intelligent_bot.xxx' doesn't exist` | Database not initialized | Run the SQL schema script to create tables |
Compatibility Notes
- MySQL 5.7: May work but not tested; MySQL 8.0 driver is used (`com.mysql.cj.jdbc.Driver`).
- Connection pool: Druid maxActive=30 limits concurrent DB connections; tune higher for high-load deployments.
- SQL logging: Enabled by default (`StdOutImpl`); disable in production by removing the `log-impl` line for performance.
Related Pages
- Implementation:A616567126_GPT_WEB_JAVA_CheckService
- Implementation:A616567126_GPT_WEB_JAVA_OrderServiceImpl
- Implementation:A616567126_GPT_WEB_JAVA_CardPinServiceImpl
- Implementation:A616567126_GPT_WEB_JAVA_InitUtil
- Implementation:A616567126_GPT_WEB_JAVA_AuthController
- Implementation:A616567126_GPT_WEB_JAVA_BaiduServiceImpl
- Implementation:A616567126_GPT_WEB_JAVA_DiscordInstanceImpl