MYSQL
板桥社小街丸
这个作者很懒,什么都没留下…
展开
-
mysql在insert和update时使用子查询
新增:INSERT INTO kfk_monitor(`topic`,`logsize`,`offset`,`lag`,`partition`,`updatetime`,`type`,`diff`)SELECT `topic`,`logsize`,`offset`,`lag`,`partition`,now(),1,10-max(`logsize`) FROM `kfk_monitor`WHERE `topic`='web' and `partition`=0更新:update `kfk原创 2021-01-26 11:26:24 · 191 阅读 · 0 评论 -
mysql按每小时、每半小时分组统计查询
按每小时:SELECT sum(`diff`) as d,HOUR(updatetime) as t,sum(lag) as lags FROM kfk_monitorWHERE topic='web' and (updatetime between '2021-01-25 00:00:00' and'2021-01-25 23:59:59')GROUP BY t按每半小时:SELECT sum(`diff`) as d,DATE_FORMAT( concat(date(updat.原创 2021-01-26 11:12:43 · 856 阅读 · 0 评论 -
druid报错discard connection,mysql报错Communications link failure
报错信息15:43:03.306 [http-nio-8080-exec-5] ERROR com.alibaba.druid.pool.DruidDataSource - discard connectioncom.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet successfully received from the server was 74,原创 2020-08-03 11:17:06 · 7574 阅读 · 1 评论 -
MySQL无法存储Emoji表情问题的解决方法
1、修改表的字符集或者某个字段的字符集为utf8mb4,与核对貌似没有关系2、mysql的jar包版本需在5.1.31以上,注意是jar包版本,不是mysql版本3、在配置文件中的连接地址后加上?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStateme...原创 2020-01-10 16:29:10 · 308 阅读 · 0 评论 -
在mybatis的映射文件中写sql语句,区分大小写的问题!
之前用mybatis写sql语句时没有注意过大小写的问题,按理说mysql是不区分大小写的。结果报错Table 'xxx' doesn't exist 表没找到。。。mybatis里的xml文件中写sql语句时要注意表名是否大小写数据库在Linux系统下 区分数据库在Windows系统下 不区分...原创 2019-11-01 16:07:20 · 2499 阅读 · 6 评论 -
mysql数据库,用mybatis的<foreach>标签批量插入大量数据时报错Packet for query......
报错信息Packet for query is too large (1706 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.允许最大的数据内存不足,执行SHOW VARIABLES LIKE '%max_allowed_packet%'语句显示如下...原创 2019-11-05 15:51:36 · 300 阅读 · 0 评论