即使使用 --local-infile=1 也无法将大 CSV 导入 MySQL 5.6

Can not import big CSV to MySQL 5.6 even using --local-infile=1

我有一个大约 600MB 大小的 CSV 文件。我想使用 SSH 将其导入 MySQL 5.6,正如我所读,我可以在 MySQL 5.7
中使用 LOAD 命令 因此,我在连接到服务器上的 MySQL 时使用了 --local-infile=1,如下所示:

mysql -u mydb -p --local-infile=1;

然后,我 运行 我的代码是这样的:

LOAD DATA LOCAL INFILE 'myfile.csv'
INTO TABLE mytable
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\'
(col1,col2,col3);

但我仍然收到此错误,而我到处阅读我可以使用 --local-infile=1

解决问题
ERROR 1148 (42000): The used command is not allowed with this MySQL version

你知道这是怎么回事吗?

将您的 Php 设置执行时间更改为无限制并使用导入 //处理csv上的分数 $location = $_FILES['fileField']['tmp_name'];

        $file = fopen($location, "r");

        while (($csvfile = fgetcsv($file, 10000, ",")) !== FALSE) {
            $firstClm = $csvfile[0];
            $secondClm = $csvfile[1];
            $thirdClm = $csvfile[2];
            //Insert to database
        }

只有在服务器允许的情况下才有效:

参见:https://dev.mysql.com/doc/refman/5.6/en/load-data.html

The LOCAL keyword affects expected location of the file and error handling, as described later. LOCAL works only if your server and your client both have been configured to permit it. For example, if mysqld was started with --local-infile=0, LOCAL does not work. See Section 6.1.6, “Security Issues with LOAD DATA LOCAL”.