我将所有character_set_*
变量转储到我的MySQL数据库中,因为我希望MySQL具有'utf8'字符集。但即使使用set names
命令后,只有少数变量发生了变化。我是否正确配置了这个?
mysql> SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| 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 |
+--------------------------+--------+
7 rows in set (0.29 sec)
mysql> set names utf8;
Query OK, 0 rows affected (0.29 sec)
mysql> SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| 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 |
+--------------------------+--------+
7 rows in set (0.29 sec)
答案 0 :(得分:2)
ALTER DATABASE your_db_name CHARACTER SET utf8;