ERROR 1148 (42000): The used command is not allowed with this MySQL version

I needed to run an import of a CSV into a MySQL table, something like:

mysql> LOAD DATA LOCAL
-> INFILE 'Z:\\MY.csv'
-> INTO TABLE `aschema`.`atable`
-> FIELDS TERMINATED BY ','
-> LINES TERMINATED BY '\n'
-> ( `client`, @sizeKB )
-> SET id = NULL, masterServer = 'something', acqTk = @acqTk, sizeMB = @sizeKB / 1024;

And I was getting the error:

ERROR 1148 (42000): The used command is not allowed with this MySQL version

I am using MySQL Workbench 8.0CE, and the server version is 5.7.30.

To get around this problem, the fix was to add --local-infile DATABASE to the mysql.exe connection command. Like so:

C:\Program Files\MySQL\MySQL Workbench 8.0 CE>mysql.exe -uUSERNAME -pPASSWORD -hHOSTNAME --local-infile DATABASE

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 251407

Server version: 5.7.30-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Then I had no problem running the LOAD DATA LOCAL. Problem solved 😀!

Comments