搜索帶表情符號(hào)的內(nèi)容時(shí),會(huì)出現(xiàn)以下的錯(cuò)誤:
Illegal mix of collations for operation 'UNION'
Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'
解決方案:
mysql數(shù)據(jù)庫的字符集需要改成:utf8mb4_general_ci
操作步驟
1、使用phpmyadmin工具,選擇當(dāng)前的數(shù)據(jù)庫
2、然后一下圖的選項(xiàng),點(diǎn)執(zhí)行

這樣就把格式批量轉(zhuǎn)換了。
3、打開數(shù)據(jù)庫配置文件config/database.php
加上以下參數(shù)
'charset' => 'utf8mb4', 'DBCollat' => 'utf8mb4_general_ci',

-----------------------------------阿里云虛擬主機(jī)設(shè)置方法-------------------------------
