Home | Mirror | Search |
目錄
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)
設置終端編碼 set names utf8;
mysql> select * from category; +----+------+-------------+--------+-----------+-----------+ | id | name | description | status | parent_id | path | +----+------+-------------+--------+-----------+-----------+ | 1 | ?? | ??????? | Y | NULL | 1/ | | 4 | ??? | ??? | Y | 1 | 1/4 | | 5 | ??? | NULL | Y | 4 | 1/4/5 | | 6 | ??? | NULL | Y | 5 | 1/4/5/6 | | 7 | ??? | NULL | Y | 6 | 1/4/5/6/7 | +----+------+-------------+--------+-----------+-----------+ 5 rows in set (0.00 sec) mysql> set names utf8; Query OK, 0 rows affected (0.00 sec) mysql> select * from category; +----+-----------+-----------------------+--------+-----------+-----------+ | id | name | description | status | parent_id | path | +----+-----------+-----------------------+--------+-----------+-----------+ | 1 | 中國 | 中華人民共和家 | Y | NULL | 1/ | | 4 | 廣東省 | 廣東省 | Y | 1 | 1/4 | | 5 | 深圳市 | NULL | Y | 4 | 1/4/5 | | 6 | 寶安區 | NULL | Y | 5 | 1/4/5/6 | | 7 | 龍華鎮 | NULL | Y | 6 | 1/4/5/6/7 | +----+-----------+-----------------------+--------+-----------+-----------+ 5 rows in set (0.00 sec)