skip to Main Content

I am try to import csv file into mysql in command prompt without workbench.
But it shows error like ERROR.
what is the best way to import csv file without workbench.

what is best way to resolve the error.

2

Answers


  1. Try this:

    LOAD DATA LOCAL
        INFILE 'yourPATH/table.csv'
        INTO TABLE `table`
        FIELDS TERMINATED BY ','
        ENCLOSED BY '"'
        LINES TERMINATED BY 'rn'
        IGNORE 0 LINES;
    

    Use this to find your path:

    SHOW VARIABLES LIKE "secure_file_priv";
    
    Login or Signup to reply.
  2. Try this to turn off the option ‘–secure-file-priv’:

    In my.cnf file, add the following line under [mysqld]:

    secure_file_priv=
    

    Generally my.cnf file is at /etc/mysql/my.cnf, or you can search it by:

    sudo find /* -name my.cnf
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search