
mysql
清风远行
所谓的吃苦受罪坚持不懈 都不是说说而已。
展开
-
MySQL 之 1215 cannot add foreign key constraint
解决1 字段与外键关联字段 ,类型一致,长度一致2 字段与外键关联字段 字符集一致原创 2019-12-17 14:43:08 · 279 阅读 · 0 评论 -
Mysql 之com.mysql.jdbc.PacketTooBigException
com.mysql.jdbc.PacketTooBigException: Packet for query is too large (6340240 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.; Packet for query is ...原创 2019-11-29 12:03:49 · 241 阅读 · 0 评论 -
MySQL 之char与varchar的区别
char与varchar CREATE TABLE vc (v VARCHAR(4), c CHAR(4)); INSERT INTO vc VALUES ('ab ', 'ab '); SELECT CONCAT(v, '+'), CONCAT(c, '+') FROM vc;解答 :它们的最大长度,尾部空格被保留等方面也不同...原创 2019-05-23 00:51:34 · 466 阅读 · 0 评论 -
MySQL 之text 和 blob
11. BLOB和TEXT值也会引起自己的一些问题,特别是执行了大量的删除或更新操作的时候。 2使用合成的(synthetic)索引3在不必要的时候避免检索大型的BLOB或TEXT值。4 把BLOB或TEXT列分离到单独的表中。...原创 2019-05-23 00:55:07 · 656 阅读 · 0 评论 -
MySQL 之 ifnull 函数
1 ifnull 函数的用法: IFNULL(expr1,expr2) 如果expr1不是NULL,IFNULL()返回expr1,否则它返回expr2。IFNULL()返回一个数字或字符串值2 ifnull 的使用场景: a: 整数类型的数据 ,如果值为null ,而希望返回结果用0替代等 select ...原创 2019-05-23 11:57:55 · 491 阅读 · 0 评论 -
MySQL 之 lpad,rpad 函数用法
lpad:函数语法:lpad(str1,length,str2)。其中str1是第一个字符串,length是结果字符串的长度,str2是一个填充字符串。如果str1的长度没有length那么长,则使用str2填充;如果str1的长度大于length,则截断。--截断--填充rpad:同理...原创 2019-05-30 11:35:48 · 8015 阅读 · 0 评论 -
MySQL 之 1215 error code
问题:字段类型一致,字段长度一致的情况下,表新建外键报错,提示如图解答: 符集不一致,造成的,把字符统一即可 ...原创 2019-05-28 11:07:37 · 772 阅读 · 0 评论 -
MySQL 之 删除语句失败
<delete id="delPromotionActivity" parameterType="Integer"> delete from promotion_activity where where id=#{id}</delete>解答:parameterType="Integer" 标注数字类型,而实际传值是Strin...原创 2019-05-29 15:57:01 · 2013 阅读 · 0 评论 -
java.io.IOException: Broken pipe
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:299) at org.apache.catalina.connect...原创 2019-06-10 10:01:33 · 2324 阅读 · 0 评论 -
MySQL 之 sql查询参数丢失,因为参数类型与表字段类型不一致
<select id="getNewsCount" parameterType="com.dxm.dto.NewsPageDto" resultType="Integer"> select count(*) from news <where> <if test="status!=null and status!='' "&g...原创 2019-07-02 17:29:11 · 940 阅读 · 0 评论 -
MySQL 之 sql injection violation, multi-statement not allow
java.sql.SQLException: sql injection violation, multi-statement not allow : update news_article set status=3 where status=2 and now() between effective_time and invalid_time; ...原创 2019-07-25 16:21:17 · 2255 阅读 · 0 评论 -
MySQL 之 ORDER BY clause is not in GROUP BY clause
055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'basedb.tcd.sale_day' which is not functionally dependent on columns in GROUP BY clause; this is inco...原创 2019-09-02 17:50:02 · 3013 阅读 · 0 评论 -
MySQL 之 InvalidConnectionAttributeException,SQLNonTransientConnectionException
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.com.mysql.cj.exceptions.InvalidConnectionAttributeException:...原创 2019-09-20 10:58:42 · 1062 阅读 · 0 评论 -
mysql之 浮点数与定点数
浮点数与定点数 为了能够引起大家的重视,在介绍浮点数与定点数以前先让大家看一个例子: mysql> CREATE TABLE test (c1 float(10,2),c2 decimal(10,2)); Query OK, 0 rows affected (0.29 sec) mysql> insert into test values(131072.32,13107...原创 2019-05-23 00:44:42 · 677 阅读 · 0 评论 -
MySQL 之 优化数据库对象
1 优化表数据类型 procedure analyse() 函数分析表字段2 通过拆分表,提高表的访问率,横向拆分,纵向拆分 纵向拆分:拆分是只按照应用访问的频度, 将表中经常访问的字段和不经常访问的字段拆分成两个表,经常访问的字段尽量是定长的,这样可以有效的提高表的查询和更新的效率 横向拆分:...原创 2019-05-24 20:18:07 · 203 阅读 · 0 评论 -
[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as
msyql 数据库 报错[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a keysql 语句创建表,报错语句如下 create table users(id int not null auto_原创 2015-04-23 14:45:13 · 14588 阅读 · 2 评论 -
oracle 追加约束
alter table *** add constraint *** 用法1.主键约束:要对一个列加主键约束的话,这列就必须要满足的条件就是非空因为主键约束:就是对一个列进行了约束,约束为(非空、不重复)以下是代码 要对一个列加主键,列名为id,表名为emp格式为:alter table 表格名称 add constraint 约束名称 增加的约束类型原创 2015-05-10 20:21:35 · 4315 阅读 · 0 评论 -
grant create view to scott
原创 2015-05-10 20:28:02 · 2231 阅读 · 0 评论 -
shell 指令复制表数据 以及表结构
需要从服务器上复制一基础数据到本地数据库。 /usr/local/youshi/mysql/bin/mysqldump -hlocalhost -uroot -p123qwe -d BsNew unicom_province >/home/BsNew.sql这个命令复制了表结构,没有表数据。需要的是数据。------------------- 不需要加-d, -原创 2015-05-06 12:13:18 · 2175 阅读 · 0 评论 -
mysql 设置时间 默认值
执行设置默认值语句 alter table cp_table modify column intime timestamp not NULL default now();原创 2015-07-08 10:21:18 · 2681 阅读 · 0 评论 -
mysql order by 造成语句 执行计划中Using filesort,Using temporary相关语句的优化解决
mysql> explain select permission.* from t_rbac_permission permission inner JOIN t_rbac_acl acl on acl.PERMISSION_ID=permission.ID where permission.menu=1 and acl.PRINCIPAL_TYPE=0 order b原创 2015-10-13 12:05:07 · 8581 阅读 · 3 评论 -
MySQL索引背后的数据结构及算法原理
网上这篇文章写得不错:http://blog.jobbole.com/24006/原创 2015-10-13 18:16:14 · 370 阅读 · 0 评论 -
mySql 查询字段拼接成字符串 group_concat 函数的
GROUP_CONCAT的使用情况如下所示原创 2019-04-22 10:29:11 · 1035 阅读 · 0 评论 -
unrecognized or represents more than one time zone
java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone conf...原创 2019-05-15 10:54:33 · 12829 阅读 · 0 评论 -
mysql 之bit_or , bit_and 做统计
create TABLE ta ( id smallint(5) unsigned NOT NULL default'0' ) insert INTO`ta` VALUES("1"),("2"),("3"),("4")select BIT_OR(id) from ta;select BIT_AND(id) from ta; alter table ta...原创 2019-05-24 19:04:56 · 1538 阅读 · 0 评论 -
Mysql 之 100万数量级,查询语句优化
单表sql数据查询对比如图:1 查询 sql语句优化 ,最有效的方式在于索引 ,建索引的规则? 查询要使用索引最主要的条件是查询条件中需要使用索引关键字, 如果是多列索引,那么只有查询条件使用了多列关键字最左边的前缀时,才可以使用索引,否则将不能使用索引2 哪些情况不会使用索引 a : 索引比全表扫描更慢...原创 2019-05-24 19:37:10 · 562 阅读 · 0 评论 -
MySQL 之 常用sql优化
1 优化insert 多条记录插入推荐:insert into test values (1,2),(1,3),(1,4)2 优化group by 默认情况小,mysql 排序所有 group by col1,col2 .......。查询方法如同在查询中指定 order by col1,col2 .....。 如果你想要避免排...原创 2019-05-24 20:07:10 · 154 阅读 · 0 评论 -
mysql error 1064,1044
1044: 数据库用户权限不足。关于错误的解释是这样的,原创 2014-11-18 16:19:02 · 485 阅读 · 0 评论