mysql8环境下
执行
select * from groups
报错:
Query execution failed
原因:
SQL 错误 [1064] [42000]: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for
the right syntax to use near 'groups
以前mysql是可以的,百思不得其解,在老版本上试了一下,可以正常执行,寻思是不是新版把这个作为保留字。
一查,果然是。
Groups is a reserved keyword in MySQL 8 #6156
-
GROUPS
(R); added in 8.0.2 (reserved)
这个就比较坑了,如果以前有版本使用这个关键字做表名,那么切换到新版mysql不是就算不兼容了嘛。切换成本太大。
ps:spring security 默认jdbc user detailsservice是使用这个作为表名的
这个就不太友好了。
参见: