mysql 计划任务

数据库链接:


mysql -uroot -p <!--数据库连接-->
mysql -h10.0.0.100 -ustaging -pn3KtxG
show databases <!--查看所有db-->
INSERT into `user` ( 
select id+3333504 ,`user_name` , `password` , 
`birthday` , `mobile` , `email` , `province` , `city` , `region` , `create_at` , `update_at` ,
`login_at` , `last_login_at` , `account_status` , `account_open_at`, `risk_at` , `risk_end` , `risk` ,
`nick` , `sms_status`, `source` , `fund_account` , `branch_no` , `id_no` , `client_name` , 
`friend_id` , `client_id` , `user_type` , `sale_licence` , `operate_code` , `user_status` , `user_trace`, `remote_addr` , `channel` 
from `user` ) <!----插入测试数据-->

计划任务:


mysql> show variables like "%pro%";<!---查一下profile是不是打开(未打开)-->
mysql> set profiling=1; <!--设置profile打开-->
mysql> use test --切换使用db
select id_no,user_name,mobile from `user` where SUBSTR(id_no,11,4)='0512' ; --执行sql
mysql> show profiles; --查看sql记录
mysql> show profile for query 2; ---查看详情计划任务
mysql> show profile block io,cpu for query 3; ---CPU、IO使用情况
mysql> show profile memory for query 3; --内存使用

时间戳:


mysql>SELECT FROM_UNIXTIME( 1249488000, '%Y%m%d' ) 
mysql> SELECT UNIX_TIMESTAMP('2009-08-06') ; 
SELECT DATE_FORMAT(date_id,'%Y-%m-%d') from batch_select_check_point a where date_id< STR_TO_DATE('2016-08-10','%Y-%m-%d')

*********************

经常用oracle,用下mysql,记录下来

原文地址:https://www.cnblogs.com/bestzhang/p/6001433.html