2010-04-29

xamppの設定(mysql の文字コード)

C:\xampp\mysql\bin 内に存在する「my.ini」を編集.mysqldの直下に下記文字列を追加.
[mysqld]
default-character-set = utf8
skip-character-set-client-handshake

同様にmysqldump, mysqlの直下にそれぞれ下記文字列を追加.
[mysqldump]
default-character-set=utf8
[mysql]
default-character-set=utf8

確認するには,コマンドプロンプトから mysql –u root でmysqlを起動し,show variables like "char%";と入力.

===== 設定前 =====
+--------------------------+----------------------------+
| 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            |                                       |
+--------------------------+----------------------------+

===== 設定後 =====
+--------------------------+----------------------------+
| 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            |                                       |
+--------------------------+----------------------  -----+

0 件のコメント: