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

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

DDD
DDDOriginal
2024-10-30 06:58:28460browse

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' ;"

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

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!

Statement:
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