InMotion Hosting Support Center

How to grant mysql server to get FILE Privilege?

Category: Databases

2012-11-02 9:59 am EST

Hits: 3,200
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!

You must login before you can ask a follow up question.

You must login before you can submit an answer.



5,889 Points
2012-11-02 10:51 am EST
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

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

You must login before you can post a comment about this answer.

I'm having the same problem with a php script that uses the LOAD DATA INFILE. I think I have to grant FILE permissions (GRANT FILE ON *.* TO 'db_user'@'localhost';), how can I do that?
3 Points
2014-06-12 3:38 am EST
This is not possible from a user's account, however, technical support may be able to make that change for you. I recommend submitting a ticket to technical support explaining the exact change that you need to make.
11,186 Points
2014-06-12 8:34 am EST
Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!