|
elcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1Server version: 5.6.25 Source distribution
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select char_length('世界sad'),length('世界sad');
+--------------------------+---------------------+
| char_length('世界sad') | length('世界sad') |
+--------------------------+---------------------+
| 5 | 9 |
+--------------------------+---------------------+1 row in set (0.00 sec)
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/local/mysql-5.6.25/share/charsets/ |
+--------------------------+-----------------------------------------+8 rows in set (0.00 sec)
mysql> set names gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'char%';
+--------------------------+-----------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.6.25/share/charsets/ |
+--------------------------+-----------------------------------------+8 rows in set (0.00 sec)
mysql> select char_length('世界sad'),length('世界sad');
+--------------------------+---------------------+
| char_length('世界sad') | length('世界sad') |
+--------------------------+---------------------+
| 6 | 9 |
+--------------------------+---------------------+1 row in set (0.02 sec)
mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)
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/local/mysql-5.6.25/share/charsets/ |
+--------------------------+-----------------------------------------+8 rows in set (0.00 sec)
mysql> select char_length('世界sad'),length('世界sad');
+--------------------------+---------------------+
| char_length('世界sad') | length('世界sad') |
+--------------------------+---------------------+
| 9 | 9 |
+--------------------------+---------------------+1 row in set (0.00 sec)
mysql>
|
|
|