![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
------【MySql】
文章平均质量分 74
_夜渐凉
_与其临渊羡鱼,不如退而结网
展开
-
You must configure either the server or JDBC driver (via the serverTimezone configuration property)
1、问题描述本地程序执行是OK,但是发布到Linux上,MySQL设置的UTC时间,在执行数据库操作的时候,就会报如下错误:Failedjava.sql.SQLException: The server time zone value 'Coordinated Universal Time' is unrecognized or represents more than one time ...转载 2020-01-06 09:03:18 · 368 阅读 · 0 评论 -
Mybatis之nextval函数生成流水号,行级锁实现线程安全的nextval()方法
mysql中实现类似oracle中的nextval函数我们知道mysql中是不支持sequence的,一般是建表的时间使这个字段自增。 如 create table table_name(id int auto_increment primary key, ...); 或者alter table table_ame add id int auto_...原创 2019-03-14 10:28:31 · 6043 阅读 · 1 评论 -
Mysql order by 多字段排序
降序desc:由大到小;升序asc:由小到大mysql单个字段降序排序:select * from table order by id desc;mysql单个字段升序排序:select * from table order by id asc;mysql多个字段排序:select * from table order by id desc,name desc;多...转载 2019-02-18 10:26:19 · 675 阅读 · 0 评论 -
Lock wait timeout exceeded try restarting transaction
@Transactional(rollbackOn = RuntimeException.class) 出现异常,数据库对应的表被锁场景: https://mp.csdn.net/postedit/86615278mysql涉及到的表引擎都是InnoDB解决方法一:临时解决办法一:执行mysql命令:show full processlist;然后找出插入语句的系...原创 2019-01-26 18:01:06 · 489 阅读 · 0 评论 -
Vue 中实现 excel文件上传功能
场景:上传excel表,并将excel表中的数据构建成实体 <div class="pull-right" v-if="doc"> <el-upload class="upload-demo" ...原创 2019-01-25 18:06:21 · 22765 阅读 · 4 评论 -
MySQL 比较常用的语句收藏(待续)
新增相关1,表新增一列 alter table student add column screenshot_checked varchar(128); 修改相关1,只修改列的数据类型的方法:通常可以写成 alter table 表名 modify column 列名 新的列的类型例如:student表中列sname的类型是char(20),现在要修改为varc...原创 2018-11-14 16:33:07 · 146 阅读 · 0 评论 -
(异常查询Empty set)mysql 中的 not in 注意事项——结果集中不能有null
注意 in 结果集有 null 不影响 not in 的结果集中出现 null 则查询结果为 Empty set 实际应用(结果集存在有null)select t1.father_id from t_pub_link_info t1;+--------------------+| father_id |+--------------------...原创 2018-10-31 14:58:11 · 2023 阅读 · 0 评论 -
Mysql数据库中tinyint(1) 存储数字时候取值为True、False解决办法
boolean类型:在Mysql中保存boolean值时:会用1代表TRUE,0代表FALSE,因为boolean在MySQL里的类型为tinyint(1)遇到mysql数据库存储字段类型为tinyint(1)的数字数值的时候,取出后会变成True、false解决办法:可以在sql语句进行处理:case 字段 when 0 then '状态1' when 1 then ...原创 2018-08-08 17:05:41 · 5341 阅读 · 0 评论 -
MySQL根据出生日期计算年龄的五种方法比较
方法一SELECT DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(birthday)), '%Y')+0 AS age方法一,作者也说出了缺陷,就是当日期为未来日期时结果为0,而不是负数;这里使用了5个函数和两个运算符。方法二SELECT DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(birthday,...转载 2018-08-09 12:34:35 · 3289 阅读 · 0 评论 -
【Oracle】和【Mysql】中SQL语句中的一些函数用法区别小结
1,mysql中的【IFNULL】与 ORACLE 中的 【NVL】用法区别在mysql中: IFNULL(expr1,expr2)的用法: 如果expr1为NULL,则返回expr2;否则返回expr1值本身。oracle中: nvl(expr1,expr2)...原创 2018-07-23 17:19:01 · 244 阅读 · 0 评论 -
MYSQL 表的类型必须是INNODB才支持事务
在Mysql中,只有当表的类型是INNODB的时候,才支持事务,所以需要把表的类型设置为INNODB,否则无法观察到事务.修改表的类型为INNODB的SQL: alter table product_ ENGINE = innodb;查看表的类型的SQL show table status from test; 不过有个前提,就是当前的MYSQL服务器本身要支持I...转载 2018-07-05 10:12:28 · 3469 阅读 · 0 评论