Home > Database > Mysql Tutorial > How to Resolve MySQL Errcode 13 with SELECT INTO OUTFILE When AppArmor is Enabled?

How to Resolve MySQL Errcode 13 with SELECT INTO OUTFILE When AppArmor is Enabled?

Mary-Kate Olsen
Release: 2025-01-24 15:01:09
Original
692 people have browsed it

How to Resolve MySQL Errcode 13 with SELECT INTO OUTFILE When AppArmor is Enabled?

Solve mysql Errcode 13 errors caused by the SELECT Into Outfile when the APPARMOR is enabled.

This article discusses the error of Ercode 13 errors encountered when using mysql

statement to export the content of the table to the CSV file.

SELECT INTO OUTFILE Question: When the user tries to export the file to the non -default directory, the user encounters permissions errors. Even if the ownership and permissions of the directory are modified, the error still exists.

Reason: The user may run the Ubuntu server version of Apparmor. APPARMOR limits access to the access to specific directory. The solution is to modify the APPARMOR configuration file of MySQLD and add the target directory to the directory list that allows access.

Solution step:

Use the command to check the Apparmor status.
  1. If MySQLD runs in the enable mode, edit the sudo aa-status file and add the desired directory to the directory list that allows access.
  2. Use the command to re -load the apparmor configuration file. /etc/apparmor.d/usr.sbin.mysqld
  3. Through the above steps, I can solve mysql Errcode 13 errors, and use the sudo /etc/init.d/apparmor reload statement to export the CSV file. It should be noted that this modification will give MySQL read and write permissions to add directory, so we must carefully weigh the hidden safety hazards.

The above is the detailed content of How to Resolve MySQL Errcode 13 with SELECT INTO OUTFILE When AppArmor is Enabled?. For more information, please follow other related articles on the PHP Chinese website!

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