Bug #83646 Improve --secure-file-priv error message
Submitted: 2 Nov 2016 8:47 Modified: 2 Nov 2016 9:15
Reporter: Ramesh Sivaraman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.6.34 OS:CentOS
Assigned to: CPU Architecture:Any

[2 Nov 2016 8:47] Ramesh Sivaraman
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>
[2 Nov 2016 9:15] MySQL Verification Team
Hello Ramesh,

Thank you for the report and feedback.
Verified as described with 5.6.34 build.

Thanks,
Umesh