用戶密碼過(guò)期策略
ALTER
USER
‘testuser``'@‘localhost'
PASSWORD
EXPIRE INTERVAL 30
DAY``;
禁用密碼過(guò)期:
ALTER
USER
'testuser'``@``'localhost'
PASSWORD
EXPIRE NEVER;
基本原理:to_days后方便計(jì)算
SELECT TO_DAYS(CURDATE()), id , TO_DAYS(CURDATE())-id, FROM_DAYS (TO_DAYS(CURDATE())-id) FROM seq_help
to_days(CURDATE()) id TO_DAYS(CURDATE())-id from_days (TO_DAYS(CURDATE())-id)
737136 1 737135 2018-03-17
737136 2 737134 2018-03-16
737136 3 737133 2018-03-15
737136 4 737132 2018-03-14
737136 5 737131 2018-03-13
737136 6 737130 2018-03-12
737136 7 737129 2018-03-11
求月初日期
select from_days(to_days(CURDATE())-DAYOFMONTH(CURDATE()-1));
2018-03-01
求日期序列
構(gòu)造一個(gè)表seq_help, 只要id字段,id自增長(zhǎng),填充100行荒叶。
SELECT TO_DAYS(CURDATE())-id dd, FROM_DAYS (TO_DAYS(CURDATE())-id) FROM seq_help