Description:
Improve --secure-file-priv error message if we use different directory name in SELECT INTO OUTFILE '<dir/file.txt>' command.
mysql> select @@secure_file_priv,@@version ;
+-------------------------------------------------------+-----------+
| @@secure_file_priv | @@version |
+-------------------------------------------------------+-----------+
| /home/ramesh/work/mysql-5.6.34-linux-glibc2.5-x86_64/ | 5.6.34 |
+-------------------------------------------------------+-----------+
1 row in set (0.00 sec)
mysql>
mysql> SELECT actor_id,first_name,last_name INTO OUTFILE '/tmp/result_act.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM actor;
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
mysql>
The error should be something like " --secure-file-priv allows path X but the statement asks for Y "
How to repeat:
mysql> select @@secure_file_priv,@@version ;
+-------------------------------------------------------+-----------+
| @@secure_file_priv | @@version |
+-------------------------------------------------------+-----------+
| /home/ramesh/work/mysql-5.6.34-linux-glibc2.5-x86_64/ | 5.6.34 |
+-------------------------------------------------------+-----------+
1 row in set (0.00 sec)
mysql>
mysql> SELECT actor_id,first_name,last_name INTO OUTFILE '/home/ramesh/work/mysql-5.6.34-linux-glibc2.5-x86_64/result_act.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM actor;
Query OK, 200 rows affected (0.00 sec)
mysql> SELECT actor_id,first_name,last_name INTO OUTFILE 'result_act.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM actor;
Query OK, 200 rows affected (0.00 sec)
mysql>
mysql> SELECT actor_id,first_name,last_name INTO OUTFILE '/tmp/result_act.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM actor;
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
mysql>