Mysql数据库默认使用的是UTF-8字符集,在使用Mysql命令操作数据库时无法显示中文出现如下的情形:
运行下面的这几行命令,就能看到正常的中文了:
mysql>SET character_set_connection = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> SET character_set_database = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> SET character_set_results = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> SET character_set_server = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> SET collation_connection = gbk_bin;
Query OK, 0 rows affected (0.00 sec)
mysql> SET collation_database = gbk_bin;
Query OK, 0 rows affected (0.00 sec)
mysql> SET collation_server = gbk_bin;
Query OK, 0 rows affected (0.00 sec)


解决方案:
Query OK, 0 rows affected (0.00 sec)
mysql> SET character_set_database = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> SET character_set_results = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> SET character_set_server = gbk;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> SET collation_connection = gbk_bin;
Query OK, 0 rows affected (0.00 sec)
mysql> SET collation_database = gbk_bin;
Query OK, 0 rows affected (0.00 sec)
mysql> SET collation_server = gbk_bin;
Query OK, 0 rows affected (0.00 sec)
