Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Permissions for mysql to export data to a file

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Question:

Mysql > select * from products into outfile "/ dbbak/outfile.txt" Fields terminated by "|" Lines terminated by "\ n"

ERROR 1 (HY000): Can't create/write to file'/ dbbak/outfile.txt' (Errcode: 13)

Solve

In the linux of the red hat series, there are restrictions on what daemon can be operated on by selinux, and the select into outfile command of mysql is the daemon of mysql to write the file. Of course, you must have permission to write a file before writing a file. Selinux restricts this permission. If selinux is closed, there is no problem with the execution of this command.

1. Close selinux

Temporary: setenforce 0

Permanent: # vim / etc/sysconfig/selinux

SELINUX=disable

2. Selinux gives the daemon permission to mysql separately.

# getsebool-a view the current permissions on a series of daemons on the system

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report