Home >Database >Mysql Tutorial >How to Enable LOAD DATA LOCAL INFILE in MySQL?

How to Enable LOAD DATA LOCAL INFILE in MySQL?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-12 22:46:14650browse

How to Enable LOAD DATA LOCAL INFILE in MySQL?

Enable LOAD DATA LOCAL INFILE in MySQL

Problem:

How to enable LOAD DATA LOCAL INFILE in the MySQL configuration file (my.cnf) for MySQL 5.5 on Ubuntu 12 LTS.

Solution:

To enable LOAD DATA LOCAL INFILE, you need to add the following option to the [mysql] section of your my.cnf file:

local-infile=1

Alternatively, you can call the MySQL client with the --local-infile option:

mysql --local-infile -uroot -pyourpwd yourdbname

You can also set the global variable at runtime with the following query:

SET GLOBAL local_infile=ON;

Additional Note:

Ensure that the local-infile parameter is also defined in the [mysqld] section of the my.cnf file to enable the "local infile" feature server-side. This restriction is in place for security reasons.

The above is the detailed content of How to Enable LOAD DATA LOCAL INFILE in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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