美文网首页
MYSQL新版问题汇总

MYSQL新版问题汇总

作者: 吉凶以情迁 | 来源:发表于2021-09-05 02:01 被阅读0次

MYSQL版本比较新,有好几个错误问题

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

-- 查看SQL_MODE
SELECT @@sql_mode;

-- 修改SQL_MODE
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

[MYSQL]Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '

select now();
show variables like "%time_zone%";
 set global time_zone = '+8:00';
 flush privileges;
 show variables like "%time_zone%"

删除数据总数遇到的问题

delete from xxxxx where id in (select t.id from xxxxx limit 0,500);
[Err] 1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

delete from xxxxx   where id in (select t.id from xxxxx    limit 0,500);

修改为

delete from xxxxx    where id in (select t.id from (select id from xxxxx    limit 0,500) as t);

查询可以这样写

select * from (select id from xxxxx   limit 12) as foo;

相关文章

网友评论

      本文标题:MYSQL新版问题汇总

      本文链接:https://www.haomeiwen.com/subject/eindwltx.html