MySQL 数据库适配
MySQL 数据库适配环境说明
本文档编写是建立在 mysql-installer-community-8.0.28.0
版本下适配的,其他版本大同小异。
建立数据库环境
下载并安装 Mysql 数据库,复制以下链接进入官网下载 Mysql 数据库:
https://dev.mysql.com/downloads/mysql/ ,链接制作参考,如以改变,请访问官网下载。
连接数据库并创建公共数据库
使用客户端软件(DBeaver)连接 Mysql 数据库,输入数据库连接配置服务器地址、用户名 root 和密码连接数据库,然后,创建公共数据库 y9_public
,如下图所示:
连接数据库
创建公共数据库
修改组织身份管理 platform 配置文件
项目工程目录:risenet-y9boot-webapp-platform/src/resources/application.yml
yaml
spring:
datasource:
druid:
filter:
wall:
#关闭 Druid 防御 SQL 注入攻击的 WallFilter,不然无法操作数据库
enabled: false
y9-public:
#修改为 mysql 驱动类名称
driver-class-name: com.mysql.cj.jdbc.Driver
#修改为 mysql 连接池 url
url: jdbc:mysql://localhost:3306/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true
#修改为 mysql 的用户
username: root
#修改为 mysql 的用户密码
password: '111111'
jpa:
#修改为 mysql 版本对应的方言
database-platform: org.hibernate.dialect.MySQL8Dialect
properties:
hibernate:
#修改为 mysql 版本对应的方言
dialect: org.hibernate.dialect.MySQL8Dialect
修改单点登录 sso 配置文件
项目工程目录:risenet-y9boot-webapp-sso-server-jpa/src/resources/application.yml
IMPORTANT
配置中的数据库连接池的配置:(注:此配置只有纯数据库模式的单点登录需要修改) 单点登录的配置需要修改两个地方:服务注册和票据注册
yaml
cas:
# 服务注册 jpa 配置
serviceRegistry:
jpa:
dialect: org.hibernate.dialect.MySQL8Dialect
driver-class: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3308/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true
user: root
password: '111111'
# 票据注册 jpa 配置
ticket:
registry:
jpa:
dialect: org.hibernate.dialect.MySQL8Dialect
driver-class: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3308/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true
user: root
password: '111111'