Troubleshoot MySQL Error Code 13: LOAD DATA INFILE Problems
Database administrators may encounter MySQL Error Code 13 when executing LOAD DATA INFILE statements. This error typically occurs when MySQL cannot access the specified file.
Problem:
A user reports an Error Code 13 when attempting to load data from a remote file into a table using the LOAD DATA INFILE query. The database user has all necessary privileges, and the file and folder permissions are set to chmod 777 (rwxrwxrwx).
Solution:
The solution to this issue lies in the Apparmor program, which exists particularly in Ubuntu systems. Apparmor prevents MySQL from accessing files in certain directories by default. To enable MySQL to read files from the "tmp" directory, follow these steps:
After completing these modifications, MySQL should be able to successfully execute the LOAD DATA INFILE query without encountering Error Code 13.
The above is the detailed content of Why Does LOAD DATA INFILE Fail with MySQL Error Code 13?. For more information, please follow other related articles on the PHP Chinese website!