mysql添加密码策略
概述今天主要介绍下MySQL数据库密码策略及用户资源限制 ,下面实验基于mysql5.7来测试。01密码策略在mysql 5.6对密码的强度进行了加强,推出了validate_password 插件。...
2024.11.23简单分享下最近做的一个mysql数据库分区表改造方案,仅供参考。
思路:(假设在2020.7.21进行表分区改造)没时间,就不画图说明了
1、创建与原始表一样结构的新表,新分区
2、往新表插入旧表在2020.7.20 00:00:00之前的数据
3、业务空闲时间段进行表切换
4、新表建索引、触发器等
5、数据补录(将原始表中超过2020.7.20 00:00:00的数据补录到新表)
一、创建新表及分区注意分区键需在主键上,且不能为null
CREATE TABLE `t_att_dd_pushcard_info_range` (`id` varchar(64) NOT NULL COMMENT ‘ID‘,`user_id` varchar(64) DEFAULT NULL COMMENT ‘员工ID‘,`work_date` varchar(64) NOT NULL COMMENT ‘工作日‘,`plan_id` varchar(64) DEFAULT NULL COMMENT ‘排班id‘,`approve_id` varchar(64) DEFAULT NULL COMMENT ‘审批id,结果集中没有的话表示没有审批单‘,....`patch_flag` varchar(1) DEFAULT NULL COMMENT ‘是否补卡 Y 是 N 否‘,PRIMARY KEY (`id`,work_date),KEY `idx_hwb1` (`user_id`,`check_type`,`work_date`) USING BTREE,KEY `idx_work_date` (`work_date`) USING BTREE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=‘钉钉打卡详情表‘/*!50500 PARTITION BY RANGECOLUMNS(work_date)(PARTITION p201909 VALUES LESS THAN (‘2019-10-01‘) ENGINE = InnoDB, PARTITION p201910 VALUES LESS THAN (‘2019-11-01‘) ENGINE = InnoDB, PARTITION p201911 VALUES LESS THAN (‘2019-12-01‘) ENGINE = InnoDB, PARTITION p201912 VALUES LESS THAN (‘2020-01-01‘) ENGINE = InnoDB, PARTITION p202001 VALUES LESS THAN (‘2020-02-01‘) ENGINE = InnoDB, PARTITION p202002 VALUES LESS THAN (‘2020-03-01‘) ENGINE = InnoDB, PARTITION p202003 VALUES LESS THAN (‘2020-04-01‘) ENGINE = InnoDB, PARTITION p202004 VALUES LESS THAN (‘2020-05-01‘) ENGINE = InnoDB, PARTITION p202005 VALUES LESS THAN (‘2020-06-01‘) ENGINE = InnoDB, PARTITION p202006 VALUES LESS THAN (‘2020-07-01‘) ENGINE = InnoDB, PARTITION p202007 VALUES LESS THAN (‘2020-08-01‘) ENGINE = InnoDB, PARTITION p202008 VALUES LESS THAN (‘2020-09-01‘) ENGINE = InnoDB, PARTITION p202009 VALUES LESS THAN (‘2020-10-01‘) ENGINE = InnoDB, PARTITION p202010 VALUES LESS THAN (‘2020-11-01‘) ENGINE = InnoDB, PARTITION p202011 VALUES LESS THAN (‘2020-12-01‘) ENGINE = InnoDB, PARTITION p202012 VALUES LESS THAN (‘2021-01-01‘) ENGINE = InnoDB, PARTITION p202101 VALUES LESS THAN (‘2021-02-01‘) ENGINE = InnoDB, PARTITION p202102 VALUES LESS THAN (‘2021-03-01‘) ENGINE = InnoDB) */二、新表插入数据insert into t_att_dd_pushcard_info_range select * from t_att_dd_pushcard_infowhere work_date=‘2020-01-01 00:00:00‘ and work_date=‘2020-03-01 00:00:00‘ and work_date=‘2020-05-01 00:00:00‘ and work_date=‘2020-07-20 00:00:00‘; 五、检查分区selectTABLE_SCHEMA,TABLE_NAME,PARTITION_NAME,PARTITION_EXPRESSION,PARTITION_DESCRIPTION,TABLE_ROWS,DATA_LENGTH / 1024 / 1024 "DATA(MB)",INDEX_LENGTH / 1024 / 1024 "INDEX(MB)",CREATE_TIME,SUBPARTITION_NAME,PARTITION_ORDINAL_POSITION FROMINFORMATION_SCHEMA.PARTITIONS WHERETABLE_NAME=‘t_att_dd_pushcard_info‘六、sql改造1、原sql
selectuser_id,class_id,className,isOffDutyFreeCheck,work_date,GROUP_CONCAT( userCheckTimeOn SEPARATOR ‘,‘ ) AS userCheckTimeOn,GROUP_CONCAT( userCheckTimeOff SEPARATOR ‘,‘ ) AS userCheckTimeOff,timeResultOn,timeResultOff,isExceedFix,normal_or_over,section_id,GROUP_CONCAT( patch_flag SEPARATOR ‘,‘ ) AS patch_flag FROM(select DISTINCTt.user_id,t.class_id,sec.class_name AS className,sec.is_off_duty_free_check AS isOffDutyFreeCheck,t.work_date,t.user_check_time AS userCheckTimeOn,‘‘ AS userCheckTimeOff,t.check_type,t.time_result AS timeResultOn,‘‘ AS timeResultOff,is_exceed_fix isExceedFix,t.normal_or_over,t.section_id,patch_flag FROMt_att_dd_pushcard_info tLEFT JOIN t_att_dd_attgroup_sec_info sec ON t.`class_id` = sec.`class_id` WHEREt.check_type = ‘OnDuty‘ AND t.`user_id` IS NOT NULL AND DATE_FORMAT ( t.work_date, ‘%Y-%m-%d‘ ) >= DATE_FORMAT ( ‘2020-07-01 09:44:37‘, ‘%Y-%m-%d‘ ) AND DATE_FORMAT ( t.work_date, ‘%Y-%m-%d‘ ) = DATE_FORMAT ( ‘2020-07-01 09:44:37‘, ‘%Y-%m-%d‘ ) AND DATE_FORMAT ( t.work_date, ‘%Y-%m-%d‘ ) =‘2020-07-01 09:44:37‘ and r.work_date概述今天主要介绍下MySQL数据库密码策略及用户资源限制 ,下面实验基于mysql5.7来测试。01密码策略在mysql 5.6对密码的强度进行了加强,推出了validate_password 插件。...
2024.11.23MySql分区、分表和分库数据库的数据量达到一定程度之后,为避免带来系统性能上的瓶颈。需要进行数据的处理,采用的手段是分区、分片、分库、分表。一些问题的解释:1.为什么要分表和分区?日常开发中我们经常...
2024.11.23什么是约束?约束实际上就是表中数据的限制条件;目的是为了保证表中的记录完整和有效。常用的约束有:1、非空约束(not null)2、唯一约束(unique)3、主键约束(primary key)4、外...
2024.11.16什么是表分区?对用户来说,分区表是一个独立的逻辑表,但是底层由多个物理子表组成,实现分区的代码实际上是通过对一组底层表的对象封装,但对SQL层来说是一个完全封装底层的黑盒子。MySQL实现分区的方式也...
2024.11.20平时工作中所遇到的问题,今天为大家整理一下,废话不多说,直接上代码建立存储过程后,需创建Mysql定时任务,来每天自动执行,我自动的版本,默认晚上11点自动调用存储过程注:如表中存在数据,必须手动对已...
2024.11.20