Mysql修改預設編碼linux
然後看到應該是這樣的:
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
檢視到以後,停止MySQL服務(bin/mysqladmin -u root shutdown在/etc/下找到my.cnf,如果沒有就把MySQL的安裝目錄下的support-files目錄下的my-medium.cnf複製到/etc/下並改名為my.cnf即可。開啟my.cnf以後,在[client]和[mysqld]下面均加上default-character-set=utf8,儲存並關閉。最後重新啟動。