Using MySQL Client access on a Linux machine to get Chinese is sometimes garbled, as follows:
Mysql> SELECT *From T_user;+----+-----------+-------------+-------------------+----------------------------------+----------+------------- --------+---------------------+-----------+| ID | User_name | User_phone | User_email | User_pwd | Pwd_salt | Create_time | Modify_time | Is_delete |+----+-----------+-------------+-------------------+----------------------------------+----------+-- -------------------+---------------------+-----------+| 1 |??? | 13285250574 | [Email protected] | 05126a423a9379d529e4ee61a212fa55 | KJUYT5 | 2016-07-15 23:38:56 | 2016-07-15 23:39:09 | 0 | | 2 |??? | 15985250574 | [Email protected] | 98bd3a1bebde01ad363d3c5a0d1e56da | 656JHU | 2016-07-15 23:39:01 | 2016-07-15 23:39:13 | 0 | | 3 |??? | 13685250574 | [Email protected] | 5470DB9B63C354F6C8D628B80AE2F3C3 | 89UIKQ | 2016-07-15 23:39:05 | 2016-07-15 23:39:16 | 0 |+----+-----------+-------------+-------------------+----------------------------------+----------+---------------------+---------------------+-----------+3 rows in Set (0.00 Sec
At this point, look at the MySQL character set and set it to the same character set as the database (table):
Mysql> Select @variable like ' character_set_results '; +----------------------------------------+| @variable like ' character_set_results ' |+----------------------------------------+| NULL |+----------------------------------------+1 row in Set (0.00 sec) MySQL> Set character_set_results= ' UTF8 '0 rows Affected (0.00 sec)
Then, the query will be able to get the normal Chinese characters:
Mysql> SELECT *From T_user;+----+-----------+-------------+-------------------+----------------------------------+----------+------------- --------+---------------------+-----------+| ID | User_name | User_phone | User_email | User_pwd | Pwd_salt | Create_time | Modify_time | Is_delete |+----+-----------+-------------+-------------------+----------------------------------+----------+-- -------------------+---------------------+-----------+| 1 | Zhao Da Bao | 13285250574 | [Email protected] | 05126a423a9379d529e4ee61a212fa55 | KJUYT5 | 2016-07-15 23:38:56 | 2016-07-15 23:39:09 | 0 | | 2 | Zhang Sanfeng | 15985250574 | [Email protected] | 98bd3a1bebde01ad363d3c5a0d1e56da | 656JHU | 2016-07-15 23:39:01 | 2016-07-15 23:39:13 | 0 | | 3 | Wang Nima | 13685250574 | [Email protected] | 5470DB9B63C354F6C8D628B80AE2F3C3 | 89UIKQ | 2016-07-15 23:39:05 | 2016-07-15 23:39:16 | 0 |+----+-----------+-------------+-------------------+----------------------------------+----------+---------------------+---------------------+-----------+3 rows in Set (0.00 sec)
MySQL client Chinese garbled problem solved