首先,我的项目运行时报错:
[ERROR] [Jetty-QTP-console-1235] [DefaultUserProvider.searchUsers:433] -- Expression #1 of ORDER BY clause is not in SELECT list, references column 'ucserver-mysql.u.creationDate' which is not in SELECT list; this is incompatible with DISTINCT
于是我先查看了我的mysql模式:
SHOW VARIABLES LIKE 'sql_mode'
发现模式是:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
基于此,我需要修改我的mysql配置,在[mysqld]下,添加
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
但是我的macOS(10.13.3)系统中是没有mysql配置文件,因为使用默认模式,所以我也找不到,这和window和Linux上面的mysql有所不同。于是我只能使用sudo新建/etc/mysql/my.cnf文件,然后在文件中加上一句:
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
最后重启mysql数据库,再执行上面查看模式语句:
成功了。