1

C:\Projects\k>mysqldump --tab=c:\temp\multifile -ps -us s mysqldump: Got error: 1: Can't create/write to file 'c:\temp\multifile\archive.txt' (Errcode: 13) when executing 'SELECT INTO OUTFILE'

How can i fix it on windows? I don't have any limitations for this user...

Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206

5 Answers5

2

Windows error 13 is "permission denied". Maybe the file already exists and you can't delete it which would be required to create a new file with that name.

Marichyasana
  • 2,966
  • 1
  • 19
  • 20
1

Possible reasons:

  1. This's the output when I run mysqldump with user work

    $ ll
    total 908
    -rw-rw-r-- 1 work  work    1824 Apr 28 14:47 test.sql
    -rw-rw-rw- 1 mysql mysql 922179 Apr 28 14:47 test.txt
    

    The test.sql is created by user work, but the test.txt is created by user mysql, so is "permission denied!". In this situation, you should chmod your directory.

  2. It is best that --tab be used only for dumping a local server. If you use it with a remote server, the --tab directory must exist on both the local and remote hosts, and the .txt files will be written by the server in the remote directory (on the server host), whereas the .sql files will be written by mysqldump in the local directory (on the client host).

    Refer: Dumping Data in Delimited-Text Format with mysqldump

  3. You need the FILE privilege in order to be allowed to use SELECT...INTO OUTFILE, which seems to be what mysqldump --tab uses to generate the tab-separated dump.

    This privilege is global, which means it may only be granted "ON ." :

    GRANT FILE ON *.* TO 'backup'@'%';
    

    Refer: Which are the proper privileges to mysqldump for the Error Access denied when executing 'SELECT INTO OUTFILE'.?

Community
  • 1
  • 1
secfree
  • 4,357
  • 2
  • 28
  • 36
0

First few ideas: is there enough space? Does mysql have rights to write there?

Another thing I found: Turning "off" the scanning of windows/temp folder in the anti-virus resolved the issue for me.

Hope it helps

ljubiccica
  • 480
  • 3
  • 17
0

I had similar error on win7 and Wn2008 R2 -- error 13 "permission denied". tried all the suggested solutions didn't work.

I created a folder e.g c:\temp and gave full control to logged in user. issue resolved.


Right click target folder --> Properties --> Security --> Edit... , Make sure permissions are editable under active user.

I observed that this problem also occurs if "Allow" permissions are grayed out for target folder even under active user. after creating new folder and granting full control, all permissions are editable and no more permission error.

yantaq
  • 3,968
  • 2
  • 33
  • 34
0

I had a similar issue and resolved it by adding "everyone" permissions to the target folder.

Mark B
  • 649
  • 5
  • 11