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.
sudo aa-status
file and add the desired directory to the directory list that allows access. /etc/apparmor.d/usr.sbin.mysqld
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!