Home > Database > Mysql Tutorial > body text

Why Does \'LOAD DATA LOCAL INFILE\' Fail with Error 1148 in MySQL?

Barbara Streisand
Release: 2024-10-30 07:49:27
Original
1004 people have browsed it

Why Does

Troubleshooting MySQL Load Data Local Infile Error

Issue:
While executing the following MySQL program, users encounter the error "ERROR 1148 (42000) at line 1: The used command is not allowed with this MySQL version."

mysql -e "load data local infile \
'/tmp/ept_inventory_wasp_export_04292013.csv' into \
table wasp_ept_inv fields terminated by ',' \
lines terminated by '\n' ;"
Copy after login

Possible Solution:

The error message suggests that the given command is not compatible with the MySQL version being used. To remedy this issue, consider modifying the command line by adding the '--local-infile=1' argument as follows:

mysql --local-infile=1 -u username -p
Copy after login

This change allows the LOAD DATA LOCAL INFILE command to execute without encountering the error.

Note that this solution involves modifying the MySQL command line rather than making global changes to the configuration. It offers a targeted workaround for the specific command in question, thus avoiding unintended consequences that could arise from altering the my.cnf file.

The above is the detailed content of Why Does \'LOAD DATA LOCAL INFILE\' Fail with Error 1148 in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!