0

I'm on a localhost, with root access.

I get the following error:

Error Code: 1. Can't create/write to file 'C:\Users\mypath\full customer table.csv' (Errcode: 13 - Permission denied)

This is the code:

select * from customer
into OUTFILE 'C:/Users/mypath/full customer table.csv'
fields terminated by ',';

Have tried granting privileges but to no avail:

GRANT All privileges ON *.* TO 'root'@'localhost';
darkace
  • 838
  • 1
  • 15
  • 27
  • Is MySQL running as a service? That could explain your issue? Create a folder C:\export and try again with 'C:\export\mytable.csv' as target. – VMai Jul 04 '14 at 15:45
  • Why will it running as a service change things? I tried what you said, didn't work :( – darkace Jul 05 '14 at 19:30
  • Because MySQL will run as an other user and have the rights of this user and not your rights. Folders under C:/Users are usually only writable for the logged on user. – VMai Jul 05 '14 at 19:34
  • It's got to be a problem of Windows file system rights. Is MySQL running as a service? If yes, which user does it uses? And what version of Windows? – VMai Jul 05 '14 at 19:38

1 Answers1

0

If the file exists already you'll need to delete before running your MYSQL code - you can't over-write a file on disk with MYSQL.
You could create a batch file to delete the file first, then have your MYSQL code run.

kbbucks
  • 108
  • 8
  • no, there's no file there at all :( I'm trying to create a new file. Maybe I'm using the wrong commands altogether? – darkace Jul 04 '14 at 14:36
  • Possibly similar?: [link](http://stackoverflow.com/questions/2783313/how-can-i-get-around-mysql-errcode-13-with-select-into-outfile) – kbbucks Jul 05 '14 at 00:44