MySQL亂碼:
用語句 show variables like 'character%'; 來檢視當前資料庫的相關編碼集。
修改My.cnf檔案增加
- [mysqld]
- character-set-server=utf8
重啟Mysql:
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+