File Permission Denied: Troubleshooting 'Load Data' Errors in MySQL
When attempting to load data from a flat file dump into a MySQL table using the 'LOAD DATA' command, a user may encounter permission errors even after adjusting table permissions. To resolve this, consider the following:
File Permissions
Check that the user attempting the load has sufficient file system permissions to read the data file. Grant the necessary 'FILE' privilege using:
GRANT FILE ON *.* TO '[user]'@'[host]' IDENTIFIED BY '[password]';
Thread Context
Ensure that the MySQL thread executing the 'LOAD DATA' command has the 'FILE' privilege. The default user for MySQL threads is 'mysql'. To grant the privilege to this user, run:
GRANT FILE ON *.* TO 'mysql'@'[host]' IDENTIFIED BY '[password]';
Additional Considerations
The above is the detailed content of Why Can\'t I Load Data into MySQL? Troubleshooting \'LOAD DATA\' Permission Errors. For more information, please follow other related articles on the PHP Chinese website!