I have the following PHP code:
$conn=new mysqli($host, $username, $password, $database);
if ($conn->connect_errno)
error_log("Failed to connect to MySQL: " . $conn->connect_error);
$conn->set_charset("utf8");
error_log("charset error" . $conn->errno);
$sql = "LOAD DATA INFILE '" . $target_file . "' INTO TABLE mytable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (col1, col2, col3, col4, col5)";
$conn->query($sql);
error_log("Result from query is " . $conn->errno);
When I look at nginx error log I do not see the first two errors happening but the last one from the query result, that always gives me error 1045 which is permission denied.
How come the first two work but the last one doesn't?
And another thing, the same user (using the same credentials) can edit the table (delete and save data) in another part of the website without problems so it isn't that the user does not have permissions to edit the database.