mysql 更改資料庫編碼utf8到utf8mb4
修改my.cnf 以下內容 [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-server = utf8mb4 ###不能只加這一行,不然會連不上SERVER collation-server = utf8mb4_unicode_ci 重新啟動MYSQL service mysql restart 進入下mysql mysql -uroot -p mysql>show variables like '%character%'; +--------------------------+---------------------------------------------+ | Variable_name | Value | +--------------------------+---------------------------------------------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4