Search code examples
mysqlmysql-error-1045into-outfile

MYSQL into outfile "access denied" - but my user has "ALL" access.. and the folder is CHMOD 777


Any ideas?

SELECT * INTO OUTFILE '/home/myacnt/docs/mysqlCSVtest.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '*'
LINES TERMINATED BY '\n'
FROM tbl_property 
WHERE managerGroupID = {$managerGroupID}

Error:

Access denied for user 'asdfsdf'@'localhost' (using password: YES)

Solution

  • Try executing this SQL command:

    > grant all privileges 
      on YOUR_DATABASE.* 
      to 'asdfsdf'@'localhost' 
      identified by 'your_password';
    > flush privileges; 
    

    It seems that you are having issues with connecting to the database and not writing to the folder you’re mentioning.

    Also, make sure you have granted FILE to user 'asdfsdf'@'localhost'.

    > GRANT FILE ON *.* TO 'asdfsdf'@'localhost';