LOAD DATA INFILE Error Code : 13

后端 未结 19 2523
有刺的猬
有刺的猬 2020-11-28 02:37

In my remote MySQL, when I try to execute this query, I am getting the MySQL Error Code : 13.

Query -

LOAD DATA INFILE 
\'/httpdocs/.../.../testFile.         


        
19条回答
  •  佛祖请我去吃肉
    2020-11-28 03:22

    1. checkout this system variable local_infile is on
     SHOW VARIABLES LIKE 'local_infile';
    +---------------+-------+
    | Variable_name | Value |
    +---------------+-------+
    | local_infile  | ON    |
    +---------------+-------+
    

    If not, restart mysqld with:

    sudo ./mysqld_safe --local-infile
    
    1. change you csv file to /tmp folder so that it mysqls can read it.

    2. import to db

    mysql> LOAD DATA INFILE '/tmp/a.csv'  INTO TABLE table_a  FIELDS TERMINATED BY ','  ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;
    Query OK, 18 rows affected (0.17 sec)
    Records: 18  Deleted: 0  Skipped: 0  Warnings: 0
    

提交回复
热议问题