ERROR 1148: The used command is not allowed with this MySQL version
You can specify that as an additional option when setting up your client connection:
mysql -u myuser -p --local-infile somedatabase
This is because that feature opens a security hole. So you have to enable it in an explicit manner in case you really want to use it.
Both client and server should enable the local-file option. Otherwise it doesn't work.To enable it for files on the server side server add following to the my.cnf
configuration file:
loose-local-infile = 1
I find the answer here.
It's because the server variable local_infile
is set to FALSE|0. Refer from the document.
You can verify by executing:
SHOW VARIABLES LIKE 'local_infile';
If you have SUPER privilege you can enable it (without restarting server with a new configuration) by executing:
SET GLOBAL local_infile = 1;
SpringBoot 2.1 with Default MySQL connector
To Solve this please follow the instructions
1. SET GLOBAL local_infile = 1;
to set this global variable please follow the instruction provided in MySQL documentation https://dev.mysql.com/doc/refman/8.0/en/load-data-local.html
2. Change the MySQL Connector String
allowLoadLocalInfile=true Example : jdbc:mysql://localhost:3306/xxxx?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&allowLoadLocalInfile=true