这个
secure_file_priv
必须准确地命名输出到的目录。不能输出到子目录中。
下面是我刚刚在笔记本电脑上使用mysql 5.6的演示:
mysql> select @@global.secure_file_priv;
+---------------------------+
| @@global.secure_file_priv |
+---------------------------+
| /tmp/ |
+---------------------------+
mysql> select 123 into outfile '/tmp/foo';
Query OK, 1 row affected (0.00 sec)
检查数据是否已写出:
$ cat /tmp/foo
123
然后尝试子目录:
mysql> select 456 into outfile '/tmp/a/b/text';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
即使我
mkdir -p /tmp/a/b
为了确保在尝试这个子目录之前,它仍然失败。