Mysql編碼備忘 – Stored Procedure 錯誤訊息

之前常發現phpmyadmin裡面,mysql有一項編碼資訊

collation connection
collation database


這兩項會不同,因為我是用utf8的編碼來做,
但Mysql 4.1之後又多了collation(連線校對)
而編碼裡又有區分utf8_general_ci , utf8_unicode_ci

原本程式運作起來沒什麼問題,但是在call之前的Stored Procedure 卻發生

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’

查詢google….上面都是在程式裡加入

SET NAMES utf8

但是我加上去卻還是一樣,
後來直接在my.cnf裡面加上

default-collation = utf8_unicode_ci

Stored Procedure 就恢復正常了…..

[相關文章]

  1. 尚無回應.

  1. 尚無引用.