Home > Database > Mysql Tutorial > How Can I Enable LOAD DATA LOCAL INFILE in MySQL 5.5?

How Can I Enable LOAD DATA LOCAL INFILE in MySQL 5.5?

DDD
Release: 2024-12-10 21:36:11
Original
1051 people have browsed it

How Can I Enable LOAD DATA LOCAL INFILE in MySQL 5.5?

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
Copy after login

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
Copy after login

Global Variable

Alternatively, you can set the global variable local_infile to ON:

SET GLOBAL local_infile=ON;
Copy after login

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
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template