mysql 保存到csv

来源:互联网 发布:淘宝买家地域分布图 编辑:程序博客网 时间:2024/05/16 13:43

select count(song_id), Ds from tb_from_view where artist_id = '0c80008b0a28d356026f4b1097041689' group by Ds order by Ds into outfile 'test.csv' fields terminated by ',';


开放读写权限 sudo chmod 777  /etc/apparmor.d/usr.sbin.mysqld


If mysqld is included in enforce mode, then it is the one probably denying the write. Entries would also be written in /var/log/messages when AppArmor blocks the writes/accesses. What you can do is edit /etc/apparmor.d/usr.sbin.mysqld and add /data/ and /data/* near the bottom like so:

...
/usr/sbin/mysqld {
    ...
    /var/log/mysql/ r,
    /var/log/mysql/* rw,
    /var/run/mysqld/mysqld.pid w,
    /var/run/mysqld/mysqld.sock w,
    /data/ r,  添加要生成文件的路径
    /data/* rw,添加要生成文件的路径

}

And then make AppArmor reload the profiles.

# sudo /etc/init.d/apparmor reload 

0 0
原创粉丝点击