[Err] 1064,err1064

來源:互聯網
上載者:User

[Err] 1064,err1064

[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中複製出來的空格有問題。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.