若查询语句为

SELECT *,count(*) as count FROM `youhui_activity_log` WHERE `type`="activity_21_page_index" AND `value`="c8" AND DATE_FORMAT(`create_time`,"%Y-%m-%d")= "2018-12-06" GROUP BY `key`;

则导出语句为

SELECT *,count(*) as count FROM `youhui_activity_log` WHERE `type`="activity_21_page_index" AND `value`="c8" AND DATE_FORMAT(`create_time`,"%Y-%m-%d")= "2018-12-06" GROUP BY `key` INTO OUTFILE '/usr/outsql/ac_log_2.xls'; 

MySQL 配置文件添加指定的导出目录

secure_file_priv = E:/

否则可能出现报错:

1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

发表评论

电子邮件地址不会被公开。 必填项已用*标注