Search code examples
mysqllinuxselectinto-outfile

select * into outfile not working even for root


When I run

mysql> select * into outfile "/home/akihirom/file1.txt" from BAIT_INTERACTION;

I get the following error:

ERROR 1 (HY000): Can't create/write to file '/home/akihirom/file1.txt' (Errcode: 13)

This happens even as root, in mysql or on the system itself. Does anyone know why this may be happening? Thanks


Solution

  • I was able to do the same thing using mysql dump by dumping the contents of the select statement to a file:

    mysql -u USERNAME --password=PASSWORD --database=DATABASE --execute='SELECT `FIELD`, `FIELD` FROM `TABLE` LIMIT 0, 10000 ' -X > file.xml
    

    Where I got the idea from