ubuntu下修改mysql默認編碼

編輯/etc/mysql/my.cnf文件,至關於windows中的my.ini: 找到[client] 添加: default-character-set = utf8 // 默認字符集爲utf8 找到[mysqld] 添加: default-character-set = utf8 //默認字符集爲utf8 init_connect = 'SET NAMES utf8' //設定鏈接mysql數據庫時使用utf8編碼,以讓mysql數據庫爲utf8運行 修改好後,從新啓動mysql sudo /etc/init.d/mysql restart 便可. 查詢一下show variables like 'character%'; +--------------------------+----------------------------+ | 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/share/mysql/charsets/ | +--------------------------+----------------------------+
相關文章
相關標籤/搜索