標籤:manual syntax sql error mysql
[Err] 1064 - 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 3
MySQL 5.6,Navicat For MySQL 10.0.10 中執行SQL語句時提示此錯誤,在CMD中執行SQL檔案中的語句時提示以下錯誤:
D:\Users\Aven>mysql -uroot -p < F:\Publish\Data\share_update.sqlWarning: Using a password on the command line interface can be insecure.ERROR 1064 (42000) at line 4: 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 ‘ALTER聽TABLE聽mcu聽CHANGE聽`LOCAL_ID`聽`LOCAL_ID`聽VARCHAR(50)聽‘at line 1
解決方案:
發現解決該問題的關鍵,是錯誤提示中的空格都是“聽”,這讓我想到是檔案的編碼問題,然後做檔案編碼的轉換。
推薦使用Notepad++,編碼轉換非常方便,
轉換為UTF-8格式,問題依舊,再轉為ANSI格式試試:
哈哈,原形畢露了吧!把?都替換為空白格,儲存,再執行,一切OK了。
反思:
為什麼會出現這種問題呢?
這些語句是從QQ複製到Word中,雙從Word中複製到Notepad++中,
估計是從QQ或Word中複製出來的空格有問題。
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL s