Home > Database > Mysql Tutorial > body text

How to Resolve \'ERROR 1148 (42000): The used command is not allowed with this MySQL version\' When Using LOAD DATA LOCAL INFILE?

DDD
Release: 2024-10-30 06:58:28
Original
459 people have browsed it

How to Resolve

MySQL Load Error: Resolving the Issue

When executing the following MySQL command at the bash command line:

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

users may encounter the error "ERROR 1148 (42000) at line 1: The used command is not allowed with this MySQL version."

Workaround

This issue can be circumvented by modifying the MySQL command line. Pass in the --local-infile=1 argument before the user and password arguments:

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

After entering the MySQL prompt, execute the LOAD DATA LOCAL INFILE command again. This should resolve the error and allow the data to be loaded into the specified table.

Note: Modifying the my.cnf configuration file to globally enable local infile loading is not recommended for this specific case, as the user desires a more localized solution.

The above is the detailed content of How to Resolve \'ERROR 1148 (42000): The used command is not allowed with this MySQL version\' When Using LOAD DATA LOCAL INFILE?. 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
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!