시도 :
mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.12-0 |
+-----------+
1 row in set (0.00 sec)
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/ |
+---------------------------+
1 row in set (0.00 sec)
변경 파일 : /etc/mysql/my.cnf
[mysqld]
.
.
.
secure_file_priv=NULL
.
.
.
다시 시작 MySQL을.
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| NULL |
+---------------------------+
1 row in set (0.00 sec)
UPDATE
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/ |
+---------------------------+
1 row in set (0.00 sec)
파일 : /var/lib/mysql-files/myfile.csv
1,"Row 1"
2,"Row 2"
3,"Row 3"
mysql> DROP TABLE IF EXISTS `test_files`;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> CREATE TABLE IF NOT EXISTS `test_files` (
-> `col0` INT,
-> `col1` VARCHAR(20)
->);
Query OK, 0 rows affected (0.00 sec)
mysql> LOAD DATA INFILE '/var/lib/mysql-files/myfile.csv'
-> INTO TABLE `test_files`
-> COLUMNS TERMINATED BY ',' ENCLOSED BY '\"'
-> LINES TERMINATED BY '\n';
Query OK, 3 rows affected (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
mysql> SELECT
-> `col0`,
-> `col1`
-> FROM
-> `test_files`;
+------+-------+
| col0 | col1 |
+------+-------+
| 1 | Row 1 |
| 2 | Row 2 |
| 3 | Row 3 |
+------+-------+
3 rows in set (0.00 sec)
사용하고있는 MySQL의 버전은 무엇? [secure_file_priv] (http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_secure_file_priv)를 참조하십시오. – wchiquito
이것은 나의 버전입니다 : 5.7.12 –
그건 그렇고,이 [http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_secure_file_priv]을 보았습니다. 그러나 저는 아닙니다. 이 NULL을 만드는 방법을 알고 있어야합니다. –