How to grant mysql server to get FILE Privilege?

Avatar
  • Answered
I'm using "LOAD DATA INFILE" in php to import csv file to mysql database and never success. I was able to do that from my previous hotsting provider. I did some research on MYSQL website and find this:

The FILE privilege gives you permission to read and write files on the server host using the LOAD DATA INFILE and SELECT ... INTO OUTFILE statements and the LOAD_FILE() function. A user who has the FILE privilege can read any file on the server host that is either world-readable or readable by the MySQL server. (This implies the user can read any file in any database directory, because the server can access any of those files.) The FILE privilege also enables the user to create new files in any directory where the MySQL server has write access. As a security measure, the server will not overwrite existing files.

Any help will be really appreciated!
Avatar
jamesr
Thank you for your question SeanL!

From what you gave us for information, it appears the permissions on the user are not allowing it. Try removing the user and re-adding it to the database. Make sure all permissions are given to the user that you are using for the php script. If this does not work, we will need to test the script to see why its failing. Please email us at

[email protected]

Please include the location of the script on the server and any login credentials and steps to take to replicate the problem. You will need to verify the account in the email with the last 4 of the credit card number or the current AMP password and we can see why its failing. Sorry for the trouble.

Best Regards

James R