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