mysql将输出结果到文件

1.sql:

select a,date_format(b,"%Y-%m") from t group by a,date_format(b,"%Y-%m") into outfile '/home/manager/group.txt';

有可能会出现

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

在shell中执行:

mysql -u root -p  -e "select a,date_format(b,'%Y-%m') from tgroup by a,date_format(b,'%Y-%m')" >/home/manager/group.sql

你可能感兴趣的:(数据库)