Skip to content

MariaDB 数据库适配

James 配置修改

James 中涉及数据库配置的配置文件 conf/james-database.properties

调整配置后需 将 MariaDB 对应的驱动包放入 lib 文件夹 中,否则启动会报驱动找不到的错

properties
database.driverClassName=org.mariadb.jdbc.Driver
database.url=jdbc:mariadb://localhost:3306/james?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true
database.username=root
database.password=111111

# James 目前没有完全兼容 MariaDB,但是可以使用 MySQL 的相关配置兼容
vendorAdapter.database=MYSQL

webmail 配置修改

配置文件所在位置 risenet-y9boot-webapp-webmail/src/main/resources/application.yml

yaml
spring:
    datasource:
        druid:
            y9-public:
                driver-class-name: org.mariadb.jdbc.Driver 
                url: jdbc:mariadb://localhost:3306/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true  
                username: root
                password: 111111
            webmail:
                # 连接 james 的库,用于邮箱的管理
                driver-class-name: org.mariadb.jdbc.Driver
                url: jdbc:mariadb://localhost:3306/james?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true
                username: root
                password: 111111
    jpa:
        #修改为 MariaDB 版本对应的方言
        database-platform: org.hibernate.dialect.MariaDB106Dialect
        properties:
            hibernate:
                #修改为 MariaDB 版本对应的方言
                dialect: org.hibernate.dialect.MariaDB106Dialect

Released under the GPL-3.0 License.