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>
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>
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!