LOAD DATA

Starting with MySQL version 3.23.49, LOAD DATA LOCAL is prohibited by default for security reasons, and it must be specifically enabled.

Our MySQL server works with LOAD DATA LOCAL enabled, but it is necessary to enable this functionality from the client side.

There are several options for enabling this option for the mysql utility:

Parameter —local-infile=1
Create a .my.cnf file in the home directory and allow this option in it for the [mysql] group that this utility uses:

[mysql]
local-infile=1

Enabling this mode from perl: it is necessary to specify the mysql configuration file in the dsn when connecting (because the libmysql library does not read any additional configuration files by default) and a group in it, create this group in the file, and set local-infile=1 for this group:

For example, enter in ~/.my.cnf

[perl]
local-infile=1

and in the script , we make the connection like this:

my $dsn = "DBI:mysql:database:hostname;mysql_read_default_group=perl;". "mysql_read_default_file=~/.my.cnf";
my $dbh = DBI->connect($dsn, "username", "password") ||die "[err]: Can't connect to MySQL: $!";

Enabling this mode from PHP: you must have your own compiled PHP interpreter installed.

In the mysql_connect() function, you must use argument 128 (the value of the CLIENT_LOCAL_FILES constant) as the fifth parameter.

Example:

$dbh = mysql_connect($server, $user, $pass, false, 128);