I get this error:-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ at line 1
whenever I tried something like this:-
mysql> source /home/user1/sql/ddl.sql mysql> source /home/user1/sql/insert.sql mysql> source /home/user1/sql/cleanup.sql
The intresting thing is, this happen to each and every one of the sql scripts but only the first statement is corrupted. The rest of the statements in the script will run fine. I have worked around this by putting a dummy statement in every script.
Anyone had this problem before? I am completely stumped and checking Google hadn’t helped yet. Thanks in advance.
A possibility is that the SQL files were written in Unicode with a BOM, which MySQL cannot interpret.
That would explain the symptoms.
A solution is to open them in a decent editor and save them back without it.
Example in VIM:
Force BOM removal
Save and quit