Use "LOAD DATA LOCAL INFILE" with Qt SQL - How to setup loose-local-infile = 1
With MySQL 8.X in order to execute "LOAD DATA LOCAL INFILE" you need to have local_infile = 1 in [mysqld] and loose-local-infile = 1 in [mysql] or [client]
Executing this command from MySQL client is ok:
Code:
LOAD DATA LOCAL INFILE '/home/cquiros/temp/GOBLET/build/GOBLET-createdb/test.csv' INTO TABLE climmob.testupload fields terminated by ',' lines terminated by '' (code,description);
However in my Qt application with QSQLQuery.exec() I get:
Quote:
LOAD DATA LOCAL INFILE file request rejected due to restrictions on access
It seems that in my Qt connection the database I need to set loose-local-infile = 1 but how to do it?
Re: Use "LOAD DATA LOCAL INFILE" with Qt SQL - How to setup loose-local-infile = 1
After checking up. There is no way to set loose-local-infile (MYSQL_OPT_LOCAL_INFILE) in the connection.
However, one can add such an option to the QMYSQL Driver and rebuild it. This I described here: https://bugreports.qt.io/browse/QTBUG-104916 then you can set it up with setConnectOptions("MYSQL_OPT_LOCAL_INFILE=1");