MySQL 's 'secure-file-priv' not allowing load data infile, even from the allocated safe folder

后端 未结 2 620
暗喜
暗喜 2021-01-07 01:23

I am trying to upload a large .csv file into a database (not on a server, just on my local computer only for my use) on MySQL. I have been having the Error Code: 12

相关标签:
2条回答
  • 2021-01-07 01:40

    I had the same issue. Using forward slashes instead of backslashes (even on Windows machine) fixed it for me.

    0 讨论(0)
  • 2021-01-07 01:55

    From the MySQL documentation for LOAD DATA INFILE:

    The file name must be given as a literal string. On Windows, specify backslashes in path names as forward slashes or doubled backslashes. The character_set_filesystem system variable controls the interpretation of the file name.

    LOAD DATA INFILE "C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/my-file.csv"
    INTO TABLE my-table
    FIELDS TERMINATED BY ','
    ENCLOSED BY '"'
    LINES TERMINATED BY '\n'
    IGNORE 1 ROWS;
    
    0 讨论(0)
提交回复
热议问题