导出表格到xls文件,报错:
mysql> select count(*) into outfile '/tmp/people.xls' from fp_people;
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
查看--secure-file-priv的值,--secure-file-priv值的默认目录是 /var/lib/mysql-files/
mysql> show variables like '%secure%';
+--------------------------+-----------------------+
| Variable_name | Value |
+--------------------------+-----------------------+
| require_secure_transport | OFF |
| secure_auth | ON |
| secure_file_priv | /var/lib/mysql-files/ |
+--------------------------+-----------------------+
3 rows in set (0.00 sec)
把输出的地址改成/var/lib/mysql-files/,语句执行成功:
mysql> select count(*) into outfile '/var/lib/mysql-files/people.xls' from fp_people;
Query OK, 1 row affected (0.01 sec)
结束。