If I want to save selected data from a table to an output file, I have to save it to the approved directory specified by the secure_file_priv
variable. However, even If change the output file path to the approved directory, it still doesn't work, producing the following error- the same error I got before I started using the secure_file_priv
specified directory:
mysql> SELECT * FROM customers
-> INTO OUTFILE " C:ProgramDataMySQLMySQL Server 5.7Uploadsoutput.txt";
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Which had me nonplussed, since I had changed the directory to the appropriate directory specified by secure_file_priv
, I shouldn't be getting that error any longer. Hoewever, when I changed the backslashes in the path to forward slashes, the query worked, and created the file.
mysql> SELECT * FROM customers
-> INTO OUTFILE "/ProgramData/MySQL/MySQL Server 5.7/Uploads/output.txt";
Query OK, 2 rows affected (0.00 sec)
Why is that? I did all of this on Windows via the command line, so I don't see why I had to use forward slashes, almost as if I was working on a *nix system.
question from:
https://stackoverflow.com/questions/65867324/why-does-the-windows-mysql-client-requrie-forward-slashes-when-using-into-outfil 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…