[MySQL] Encoding 관련 Parameters

* Client characterset, Server characterset

mysql> status

————–

mysql  Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1

Connection id:          72

SSL:                    Not in use

Current pager:          stdout

Using outfile:          ”

Using delimiter:        ;

Server version:         5.1.41-3ubuntu12.10 (Ubuntu)

Protocol version:       10

Connection:             Localhost via UNIX socket

Client characterset:    latin1

Server characterset:    latin1

UNIX socket:            /var/run/mysqld/mysqld.sock

Uptime:                 39 sec

Threads: 1  Questions: 259  Slow queries: 0  Opens: 231  Flush tables: 1  Open tables: 56  Queries per second avg: 6.641

————–

mysql> 

* /etc/mysql/my.cnf [client]

[mysqld]
default-character-set = utf8

 

mysql> show variables like ‘%char%’;

+————————–+—————————-+

| Variable_name            | Value                      |

+————————–+—————————-+

| character_set_client     | latin1                     |

| character_set_connection | latin1                     |

| character_set_database   | utf8                       |

| character_set_filesystem | binary                     |

| character_set_results    | latin1                     |

| character_set_server     | utf8                       |

| character_set_system     | utf8                       |

| character_sets_dir       | /usr/share/mysql/charsets/ |

+————————–+—————————-+

8 rows in set (0.00 sec)

mysql>

* Database

mysql> ALTER DATABASE reviewdb DEFAULT charset=utf8;

* Table 및 Column

mysql> ALTER TABLE `reviewdb`.`patch_comments` MODIFY COLUMN `message` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`change_messages` MODIFY COLUMN `message` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`account_groups` MODIFY COLUMN `name` VARCHAR(255)  CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

mysql> ALTER TABLE `reviewdb`.`account_group_names` MODIFY COLUMN `name` VARCHAR(255)  CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

mysql> ALTER TABLE `reviewdb`.`accounts` MODIFY COLUMN `full_name` VARCHAR(255)  CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`accounts` MODIFY COLUMN `preferred_email` VARCHAR(255)  CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`account_external_ids` MODIFY COLUMN `email_address` VARCHAR(255)  CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`account_groups` MODIFY COLUMN `description` TEXT  CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`projects` MODIFY COLUMN `description` TEXT  CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;

mysql> ALTER TABLE `reviewdb`.`projects` MODIFY COLUMN `name` VARCHAR(255)  CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

 

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다