KP Solutions

Solutions for Day to Day Technical Problems

Load Data Infile Causes SQLState 28000: Invalid authorization specification


If you are using Load Data Infile and you get the error

SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user

This is an error where the database user that is used for database connection is missing a permission required to execute ‘LOAD DATA INFILE’ command. The missing permission is ‘FILE’ previlege. To issue the ‘FILE’ permission you issue following command using ‘root’ mysql user for the database user (for eg. ‘kpsolution’) .

GRANT FILE ON * . * TO ‘kpsolution’@’localhost’;

Once the database user (‘kpsolution’ in our case) is granted the ‘FILE’ permission, you will be able to execute the ‘LOAD DATA INFILE’ command without issue.

Let me know if you encounter any issues and I will definitely give it a try to resolve your issue.

Ketan Patel