Edit my.cnf with this command :
$ sudo vi /etc/mysql/my.cnf
in [client] section, add this :
default-character-set = utf8and, in [mysqld] section, add these :
default-character-set=utf8
default-collation=utf8_general_ci
init_connect=set collation_connection=utf8_general_ci
init_connect=set names utf8
character-set-server=utf8
collation-server=utf8_general_ci
character-set-client-handshake = TRUE
The restart mysqld
$ sudo /etc/init.d/mysql restart
Confirm :
mysql> show variables like 'char%'
-> ;
+--------------------------+----------------------------+
| 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 | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
* IMPORTANT : Create database with "defalut charset=utf8" option.
user@myserver:/home/user$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 56
Server version: 5.1.41-3ubuntu12.7 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database DBNAME default charset=utf8;
Query OK, 1 row affected (0.00 sec)
mysql> Bye
2. Django settting
in settings.py add this :
LANGUAGE_CODE = 'ko-KR'./managy.py syncdb should be run.
Then, 한글 입력 is ok in Django application.
댓글 없음:
댓글 쓰기