解决:CentOS下MySQL执行select ... into outfile ...: Can't create/write to file '...' (Errcode: 13)

来源:互联网 发布:淘宝怎么注册卖家 编辑:程序博客网 时间:2024/05/18 12:44

原因:selinux阻止写入操作

解决:vi /etc/selinux/config

# 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# SELINUXTYPE= can take one of these two values:#     targeted - Targeted processes are protected,#     mls - Multi Level Security protection.SELINUXTYPE=targeted
将:SELINUX=enforcing   改为 SELINUX=disabled
SELINUX=enforcing 改为 SELINUX=disabled

保存并且重启服务器:reboot

再次执行命令:select ...  into outfile ...

则执行成功:Query OK, 0 rows affected


注:关闭selinux可能会带来安全问题暂时还没有深入研究(建议操作完成后,改回配置文件)

阅读全文
0 0
原创粉丝点击