LOAD DATA INFILE Fails with "The Used Command is Not Allowed with This MySQL Version"
When attempting to use the LOAD DATA INFILE command in PHP to import data from a CSV file, users may encounter an error message indicating that the command is incompatible with the MySQL version. This issue can be attributed to the local_infile server variable being disabled.
To address this issue without altering server settings, a potential workaround is to run MySQL using the --local-infile=1 option. By launching MySQL from the console as follows:
mysql -u USER -p --local-infile=1 DATABASE
You should then be able to execute the LOAD DATA command successfully. If this approach proves effective, it may be necessary to persistently enable local file loading by modifying the MySQL configuration or reinstalling the software with the appropriate compile-time option.
The above is the detailed content of Why does 'LOAD DATA INFILE' Fail with 'The Used Command is Not Allowed with This MySQL Version'?. For more information, please follow other related articles on the PHP Chinese website!