Enabling LOAD DATA LOCAL INFILE in MySQL 5.5
MySQL's LOAD DATA LOCAL INFILE feature allows data to be loaded directly from a local file into a table. However, enabling this feature requires certain configurations.
My.cnf Configuration
To enable LOAD DATA LOCAL INFILE in your my.cnf file, add the following entry to the [mysqld] section:
local-infile=1
Make sure to replace "1" with the desired value (0 to disable, 1 to enable).
Runtime Configuration
You can also enable the feature at runtime using the --local-infile option when starting the MySQL client:
mysql --local-infile -uroot -pyourpwd yourdbname
Global Variable
Alternatively, you can set the global variable local_infile to ON:
SET GLOBAL local_infile=ON;
Server-Side Configuration
For the "local infile" feature to work, ensure that the same local-infile parameter is defined in both the [mysql] and [mysqld] sections of your my.cnf file. Additionally, the server-side setting should also be enabled:
[mysqld] local-infile=1
This security restriction prevents unauthorized data loading from local files. By completing these steps, you can successfully enable LOAD DATA LOCAL INFILE in MySQL 5.5.
The above is the detailed content of How Can I Enable LOAD DATA LOCAL INFILE in MySQL 5.5?. For more information, please follow other related articles on the PHP Chinese website!