MySQL reports an error using load data local infile

An error occurs when trying to execute the following statement in MySQL 8.0 on Windows system

mysql> LOAD DATA LOCAL INFILE '/path/filename' INTO TABLE tablename;

 

ERROR   one thousand one hundred and forty-eight  ( 42000): The used command is not allowed with this   MySQL version

The instruction used is not allowed in the current MySQL version

But in fact, MySQL 5.1 and above support this command. This error is reported because it is not allowed to load data locally when the system variable local infile = 0 in MySQL. Find the configuration file my.ini in the installation directory, modify the local infile = 1, or add the — local infile option when starting mysql

mysql -uroot –local-infile=1 -p

password:******

 

ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

MySQL service is running with — secure file priv option, so this statement cannot be executed

The reason for the error is that after MySQL version 5.7.6, the imported file can only be imported in secure_file_Under the folder specified by priv (due to insufficient permissions), we can use show variables like ‘% secure%’; The command displays the file directory, places the files to be imported in the folder specified by the secure file priv parameter, and then imports them from here

 

ERROR 2 (HY000): File not found (OS errno 2 – No such file or directory)

File not found

When providing file paths under Windows system, you need to change all “\ to” \ \ “, such as C: \ \ program files \ \ MySQL \ \ MySQL server 8.0 \ \ file

Similar Posts: