mysql -uroot -p
use databasexxx;
select user, host, password from user into outfile '/tmp/data.xls';
select b.name,a.title,a.answer from plugin_faq_question a join plugin_faq_category b on a.category_id = b.id into outfile '/tmp/data.xls';
-- 执行上述命令会提示下面的错误
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
-- 解决1,查看下面这个变量指示的路径,把文件导出到该路径下即可
SHOW VARIABLES LIKE "secure_file_priv";
select user, host, password from mysql.user into outfile '/var/lib/mysql-files/data.xls';
缺点: 数据中存在html字符时会有格式问题