Home > Database > Mysql Tutorial > body text

Why Is MySQL Throwing Error Code 13: Unable to Access Remote File?

Barbara Streisand
Release: 2024-11-03 19:47:29
Original
892 people have browsed it

Why Is MySQL Throwing Error Code 13: Unable to Access Remote File?

LOAD DATA INFILE Error Code 13: Unable to Access Remote File

When executing a LOAD DATA INFILE query, MySQL users may encounter Error Code 13 due to permission issues or apparmor restrictions.

Identifying the Root Cause

Despite granting full privileges to the database user and setting file/folder permissions to 777, the error persists. This issue likely stems from apparmor, a program in Ubuntu that hinders MySQL's file access.

Resolving the Issue

  1. Edit the Apparmor Configuration:

    Open the apparmor configuration file: sudo vim /etc/apparmor.d/usr.sbin.mysqld.

  2. Add File Directory:

    Add the following line to the configuration file: /tmp/** rwk. This grants MySQL read, write, and execute permissions to the "/tmp" directory.

  3. Reload Apparmor:

    Restart apparmor with: sudo /etc/init.d/apparmor reload.

Additional Notes

Note that the directory added to the configuration file may vary depending on the location of the file used in the LOAD DATA INFILE query. It is also recommended to use a specific subdirectory rather than granting access to the entire "/tmp" directory.

The above is the detailed content of Why Is MySQL Throwing Error Code 13: Unable to Access Remote File?. 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