常见问题
为什么修改了数据库数据,查询时数据并未更改?
回答
部分数据采用热缓存,如果直接更新数据库,缓存并未更新。
可以尝试清空redis缓存试试
如果使用Linux 提示表不存在?
回答
设置大小写敏感配置在/etc/my.cnf添加lower_case_table_names=1,重启MYSQL服务
项目启动后登录异常?
text
[http-nio-9218-exec-8] INFO c.c.m.o.s.i.LoginServiceImpl - [login,151]
- 用户:admin登录客户端:失败Authentication failed for token submission
[cn.com.mfish.oauth.common.MyUsernamePasswordToken - admin, rememberMe=false].
Possible unexpected error?(Typical or expected login exceptions should extend from AuthenticationException).
回答
可以通过清空redis缓存再试。如果还是无法登录需要排查其他问题。下面也是登录失败案例。
text
[http-nio-9218-exec-8] INFO c.c.m.o.s.i.LoginServiceImpl - [login,151] - 用户:admin登录客户端:失败Authentication failed for token submission [cn.com.mfish.oauth.common.MyUsernamePasswordToken - admin, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
[http-nio-9218-exec-6] INFO c.c.m.o.c.AuthorizeController - [authorize,101] - 用户:null登录状态:false
[http-nio-9218-exec-6] DEBUG c.c.m.o.m.S.getUserById - [debug,137] - ==> Preparing: select u., GROUP_CONCAT(DISTINCT role_id) roleIds, GROUP_CONCAT(DISTINCT org_id) orgIds from (select u., ou.org_id, ur.role_id from sso_user u left join sso_org_user ou on ou.user_id = u.id left join sso_org o on o.id = ou.org_id AND o.status = 0 and o.del_flag = 0 left join sso_user_role ur on u.id = ur.user_id left join sso_role r on r.id = ur.role_id and r.del_flag = 0 and r.status = 0 union select u., ou.org_id, sor.role_id from sso_user u join sso_org_user ou on ou.user_id = u.id join sso_org o on o.id = ou.org_id AND o.status = 0 and o.del_flag = 0 join sso_org_role sor on sor.org_id = o.id join sso_role r on r.id = sor.role_id and r.del_flag = 0 and r.status = 0) u WHERE u.id = ? group by u.id
[http-nio-9218-exec-6] DEBUG c.c.m.o.m.S.getUserById - [debug,137] - ==> Parameters: 1(String)
[http-nio-9218-exec-6] ERROR druid.sql.Statement - [statementLogError,148] - {conn-10005, pstmt-20010} execute error. select u., GROUP_CONCAT(DISTINCT role_id) roleIds, GROUP_CONCAT(DISTINCT org_id) orgIds
from (select u.*, ou.org_id, ur.role_id
from sso_user u
left join sso_org_user ou on ou.user_id = u.id
left join
sso_org o on o.id = ou.org_id
AND o.status = 0 and o.del_flag = 0
left join sso_user_role ur on u.id = ur.user_id
left join sso_role r on r.id = ur.role_id and r.del_flag = 0 and r.status = 0
union
select u.*, ou.org_id, sor.role_id
from sso_user u
join sso_org_user ou on ou.user_id = u.id
join sso_org o on o.id = ou.org_id
AND o.status = 0 and o.del_flag = 0
join sso_org_role sor on sor.org_id = o.id
join sso_role r on r.id = sor.role_id and r.del_flag = 0 and r.status = 0) u
WHERE u.id = ?
group by u.id
java.sql.SQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'u.account' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
回答
由于mysql5.7以上版本默认不支持group by以后查询非group by字段,系统中使用了类似SQL可以通过
修改mysql配置my.ini或者my.conf中的sql_mode配置,去除only_full_group_by选项
如下:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
如遇到无法解决的问题请到Issues反馈,会不定时进行解答。