1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| mysql> show variables like 'character%'; +--------------------------+----------------------------+ | 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/ | +--------------------------+----------------------------+ mysql> select char_length('a'); +------------------+ | char_length('a') | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec)
mysql> select length('a'); +-------------+ | length('a') | +-------------+ | 1 | +-------------+ 1 row in set (0.00 sec)
mysql> select char_length('汉'); +--------------------+ | char_length('汉') | +--------------------+ | 1 | +--------------------+ 1 row in set (0.00 sec)
mysql> select length('汉'); +---------------+ | length('汉') | +---------------+ | 3 | +---------------+ 1 row in set (0.00 sec)
|