Creating / Writing Permissions in MySQL

I am having some problems with the permissions with the instruction SELECT ... INTO OUTFILE.

When entering my database and executing a simple export command, for example:

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

I get the answer:

ERROR 1 (HY000): 
Can't create/write to file '/home/mropa/Photos/Desktop/TEST.txt' 
(Errcode: 13)

However, when I just write:

mysql> select * from XYZ into outfile 'TEST.txt';
Query OK, 8287 rows affected (0.73 sec)

The file is written to the directory /var/lib/mysql/XYZ. I looked at the file /etc/apparmor.d/usr.sbin.mysqldwhere mysql seems to determine read and write permissions, but I really don't know how to change it.

How do I allow my mysql table to be exported to any directory that I like?

+5
source share
5 answers

- . mysqld current_user. mysqld , (, ) outfile.

+4

, , mysqld ( "mysql" ) . :

chmod a+w /home/mropa/mysql
+2

, . mysql .

, mysql,

chown mysql: mysql on/home/mropa/Photos/Desktop/logs , mysql mysql , . , , .

Chown Command

+1
+1

mysql mysqld. apparmor. .

0
source

All Articles