Security Considerations for LOAD DATA LOCAL [client] loose-local-infile=1 If  LOCAL  capability is disabled, on either the server or client side, a client that attempts to issue a  LOAD DATA LOCAL  statement receives the following error message: ERROR 3950 (42000): Loading local data is disabled; this must be enabled on both the client and server side As of MySQL 8.0.21, the MySQL client library enables client applications to restrict local data loading operations to files located in a designated directory. Certain MySQL client programs take advantage of this capability. Client programs that use the C API can control which files to permit for load data loading using the  MYSQL_OPT_LOCAL_INFILE  and  MYSQL_OPT_LOAD_DATA_LOCAL_DIR  options of the mysql_options() C API function (see mysql_options()). The effect of  MYSQL_OPT_LOAD_DATA_LOCAL_DIR  depends on whether  LOCAL  data loading is enabled or disabled: MySQL client programs use the preceding  mysql_options()  options as follows: When  --load-data-local-dir  applies, the option value designates the directory in which local data files must be located. Comparison of the directory path name and the path name of files to be loaded is 1180 •If  LOCAL  data loading is disabled, either by default in the MySQL client library or by specifying  -- local-infile=0 , the  --load-data-local-dir  option applies. •If  LOCAL  data loading is enabled, either by default in the MySQL client library or by specifying  -- local-infile[=1] , the  --load-data-local-dir  option is ignored. •The  mysql  client has a  --load-data-local-dir  option that takes a directory path or an empty string.  mysql  uses the option value to set the  MYSQL_OPT_LOAD_DATA_LOCAL_DIR  option (with an empty string setting the value to the null pointer). The effect of  --load-data-local-dir  depends on whether  LOCAL  data loading is enabled: •If the value is a directory path name,  LOCAL  data loading is permitted but restricted to files located in the named directory. Comparison of the directory path name and the path name of files to be loaded is case-sensitive regardless of the case sensitivity of the underlying file system. •If the value is the null pointer (the default), it names no directory, with the result that no files are permitted for  LOCAL  data loading. •If  LOCAL  data loading is disabled, either by default in the MySQL client library or by explicitly disabling  MYSQL_OPT_LOCAL_INFILE , the  MYSQL_OPT_LOAD_DATA_LOCAL_DIR  option can be used to designate a permitted directory for locally loaded files. In this case,  LOCAL  data loading is permitted but restricted to files located in the designated directory. Interpretation of the MYSQL_OPT_LOAD_DATA_LOCAL_DIR  value is as follows: •If  LOCAL  data loading is enabled, either by default in the MySQL client library or by explicitly enabling MYSQL_OPT_LOCAL_INFILE , the  MYSQL_OPT_LOAD_DATA_LOCAL_DIR  option has no effect. •In all cases, successful use of a  LOCAL  load operation by a client also requires that the server permits local loading. Restricting Files Permitted for Local Data Loading