Home > Database > Mysql Tutorial > How to Resolve MySQL Error 1148: Local Data Loading Disabled?

How to Resolve MySQL Error 1148: Local Data Loading Disabled?

Mary-Kate Olsen
Release: 2025-01-24 10:04:19
Original
207 people have browsed it

How to Resolve MySQL Error 1148: Local Data Loading Disabled?

Troubleshooting MySQL Error 1148: Local Data Loading Prohibited

The "ERROR 1148: The used command is not allowed with this MySQL version" message typically arises when using LOAD DATA LOCAL in MySQL. This is a security precaution; local file loading is disabled by default.

To enable this functionality, you need to explicitly permit it at both the client and server levels.

Client-Side Configuration:

When connecting to your MySQL server, use the --local-infile option:

<code class="language-bash">mysql -u myuser -p --local-infile mydatabase</code>
Copy after login

Remember: Enabling local data loading compromises security. Only enable it when absolutely necessary and understand the risks involved.

Server-Side Configuration:

Modify your MySQL server's configuration file (my.cnf or equivalent) to enable loose-local-infile. Add or uncomment the following line:

<code>loose-local-infile = 1</code>
Copy after login

Restart your MySQL server for the changes to take effect. After completing these steps, the LOAD DATA LOCAL command should function correctly. Always prioritize security best practices when managing your database.

The above is the detailed content of How to Resolve MySQL Error 1148: Local Data Loading Disabled?. 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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template