可能重复:
一直到 UTF-8
我在将数据库中的所有内容更改为 utf8 时遇到了一些困难。
这是我目前拥有的:
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+--------------------------+----------------------------+
我有一个/etc/my.cnf
包含以下内容的文件:
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
当我$ sudo service mysql restart
“加载”文件时,什么也没有发生。我怎样才能得到utf8
这里的一切?
mysql> show variables like '%init_file%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| init_file | |
+---------------+-------+