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

How to Enable LOAD DATA LOCAL INFILE in MySQL on Ubuntu?

Barbara Streisand
Barbara StreisandOriginal
2024-12-21 15:08:10490browse

How to Enable LOAD DATA LOCAL INFILE in MySQL on Ubuntu?

Unveiling LOCAL DATA INFILE in MySQL on Ubuntu: A Guide

As you grapple with the elusive "The used command is not allowed with this MySQL version" error while attempting to enable LOAD DATA LOCAL INFILE, let's delve into the inner workings of MySQL to find a solution.

According to the MySQL 5.5 documentation, LOCAL INFILE only functions when both the server and client are configured to allow it. This suggests that you may have missed a crucial step in configuring your settings.

To rectify this issue, you need to add the option "local-infile=1" to your my.cnf file within the [mysql] entry. Alternatively, you can launch the MySQL client with the "--local-infile" parameter.

For an instant fix, you can modify the global variable at runtime using the following query:

SET GLOBAL local_infile=ON;

Remember, it's imperative to define the "local-infile" parameter in your [mysqld] section of the my.cnf file as well. This ensures that the "local infile" feature is enabled server-side.

It's worth noting that these restrictions are in place for security reasons. By configuring "local-infile" appropriately, you can safeguard your database against potential vulnerabilities.

The above is the detailed content of How to Enable LOAD DATA LOCAL INFILE in MySQL on Ubuntu?. 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