问题描述
我正在尝试启动一个包含嵌入式Keycloak授权服务器following this tutorial的Spring Boot服务器。教程的代码为here。我自己改编的是一个MysqL数据库,而不是H2,它是通过docker-compose
在服务器启动时,在应用数据库补丁时出现此错误:
Caused by: java.sql.sqlSyntaxErrorException: Table 'auth.client_session' doesn't exist
。 SequelPro引发了相同的错误,但是表格在视觉上在那里。我通过looking around this thread解决了这个问题。 (重启对我来说足够了)
下一个错误来自下一个补丁,引用为:keycloak java.sql.sqlSyntaxErrorException: Table 'client_attributes' already exists
,由于这个错误,我陷入了数据库迁移的困境,因为如果我删除它,它将转回到“不存在”错误。
版本:
- Spring Boot 2.2.4.RELEASE
- MysqL 5.7.32
- org.keycloak:keycloak-dependencies-server-all:10.0.1
解决方法
将MySQL的lower_case_table_names
配置更改为1
可解决此问题。受this answer的启发。
要通过docker-compose
刻录此设置,请在yaml
文件(受this repo启发)中自定义命令:
db-service:
[...]
ports:
- 3306:3306
command: mysqld --lower_case_table_names=1
还请确保表的编码为UTF-8
,以避免出现另一个磁头刮擦错误:keycloak Row size too large. The maximum row size for the used table type,not counting BLOBs,is 65535
其他参考文献: