当前位置:   article > 正文

mysql 写权限,在MySQL中创建/写入权限

mysql 写权限,在MySQL中创建/写入权限

I am experiencing some permission problems with my SELECT ... INTO OUTFILE statement.

When I log into my database and do a simple export command, eg:

mysql> select * from XYZ into outfile '/home/mropa/Photos/Desktop/TEST.txt';

I get the respond:

ERROR 1 (HY000):

Can't create/write to file '/home/mropa/Photos/Desktop/TEST.txt'

(Errcode: 13)

However, when I simply write:

mysql> select * from XYZ into outfile 'TEST.txt';

Query OK, 8287 rows affected (0.73 sec)

The file is written into the directory /var/lib/mysql/XYZ.

I looked into the file /etc/apparmor.d/usr.sbin.mysqld where mysql seems to define the reading and writting permissions but I don't really know how to modify it.

How can I give myself permission to export a mysql table into any directory I like?

解决方案

The issue is directory permissions. mysqld does not run as current_user. Add the mysqld user to the group that has write permissions on your target directories (convenient, but not as secure) or remember to change your target directory permissions before and after you write the outfile.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/949780
推荐阅读
相关标签
  

闽ICP备14008679号