2011-12-06 395 views
0

我在我的MySQL數據庫中傾銷了所有character_set_*變量,因爲我希望MySQL具有'utf8'字符集。但即使在使用set names命令後,也只有很少的變量發生了變化。我是否正確配置了這個?如何更改mysql數據庫中的字符集

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) 
+1

我最近在幾個月前處理過這個問題,發佈了一篇關於它的博客文章。 http://melikedev.com/2011/07/26/mysql-percona-setting-character-sets-and-collat​​ions-to-utf/ –

回答

2

ALTER DATABASE your_db_name CHARACTER SET utf8;

相關問題