mysqldump 导出失败:Can't create/write to file (Errcode: 13) when executing 'SELECT INTO OUTFILE'

问题描述:

解决办法:


1、目录权限不够,修改成777权限

     shell>chmod 777 XXXX

2、关闭防火墙selinux

  shell>vi /etc/selinux/config

  修改SELINUX=disabled关闭selinux就可以了,这个问题就可以解决了。

  不过全部关闭SELINUX有带来一些安全问题。

mysqldump 导出失败:Can't create/write to file (Errcode: 13) when executing 'SELECT INTO OUTFILE'_第1张图片

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

3、单独给mysql的守护进程权限

shell>getsebool -a可以查看当前的对系统一系列守护进程的权限情况。

lpd_disable_trans --> off
mail_read_content --> off
mailman_mail_disable_trans --> off
mdadm_disable_trans --> off
mozilla_read_content --> off
mysqld_disable_trans --> off
nagios_disable_trans --> off
named_disable_trans --> off
named_write_master_zones --> off
nfs_export_all_ro --> on
nfs_export_all_rw --> on
nfsd_disable_trans --> off
nmbd_disable_trans --> off
nrpe_disable_trans --> off

/*root用户下执行,-P表示 是永久性设置*/

shell>setsebool -P mysqld_disable_trans=1

在ubuntu下 ,可以对AppArmor(/etc/apparmor.d/usr.sbin.mysqld) 修改,类似selinux。

转载于:https://www.cnblogs.com/xiaole10368/p/5753195.html

你可能感兴趣的:(mysqldump 导出失败:Can't create/write to file (Errcode: 13) when executing 'SELECT INTO OUTFILE')