This problem drove me nuts. The PHP code running PDO SQL queries ran fine on an old server, but threw this PDO Exception on the newly installed one. The solution included:
- GRANT FILE ON *.* TO 'USER'@'localhost'; - it is NOT sufficient to use GRANT ALL PRIVILEGES.
- Set local-infile=1 in my.cnf
- Set max_allowed_packet in my.cnf to a sufficient size