Search code examples
mysqlselectinto-outfileselect-into-outfile

MySQLdump with WINDOWS10 : OS errno 13 - (Permission denied) when executing 'SELECT INTO OUTFILE'


I am unable to write tab separated text files into specified TSV/ folder using mysqldump on WINDOWS10 (MySQL80 service).

  • The Command prompt (or powershell) is in admin mode.
  • secure-file-priv ="" in my.ini MySQL config file.
  • MySQL was installed on my local computer and I use a localhost connection with the root username.

Command is: mysqldump -T C:\Users\...\20200430_Dump\TSV\ --user root -p database_name

OUTPUT:

mysqldump: Got error: 1: Can't create/write to file 'C:\Users...\20200430_Dump\TSV\table_name.txt' (OS errno 13 - Permission denied) when executing 'SELECT INTO OUTFILE'.

They are many related post on LINUX but I am specifically looking for an solution for WINDOWS

My small hypothesis: Some linux posts suggest that mysqld use a specific user-account (that seems to be mysql in linux but this is unfortunately not documented at all for any OS). So I imagine that when the server is executing INTO OUTFILE queries he needs to have permission for the TSV/ folder, but i do not know how to do give him this permission in WINDOWS.

best


Solution

  • Left click on your TSV/ folder > Properties > Security Tab > Edit > Add

    You need to add NETWORK SERVICE in Group or User names with Full control privilege (probably just Write is sufficient).

    enter image description here

    The mysqldump now works (tested on windows10)