/*************************************************************************** * MySQL Character Set setting * Description: * Database This block is often due to incompatible character sets resulting in data communication anomalies, so this side of the * MySQL character set to Utf-8, this is more general. * 2016-9-24 Shenzhen Nanshan Ping Shan village Zengjianfeng ******************************************************* *******************/First, reference documents:1. (original) Linux under MySQL5.5/5. 6 modified Character set encoding for UTF8 (completely solve Chinese garbled problem) http://www.ha97.com/5359.htmlIi. Solutions: Cat/etc/my.cnf ... [Client] ...default-character-Set=UTF8 ... [MySQL] ...default-character-Set=UTF8 ... [Mysqld] ... collation-server =utf8_unicode_ci Init-connect=' SET NAMES utf8′character-Set-server =UTF8 ... Third, view results: [[email protected]~]# Mysql-u Root-P Enter Password:welcome to the MySQL Monitor. Commands End With; or \g. Your MySQL Connection ID is 1Server Version:5.1. the-Log Source Distribution Copyright (c) -, -, Oracle and/or its affiliates. All rights reserved. Oracle isA registered trademark of Oracle Corporation and/or its affiliates. Other names trademarks of their respective owners. Type'Help ;'Or'\h' forHelp. Type'\c'To clear the current input statement. 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/| +--------------------------+----------------------------+8Rowsinch Set(0.00sec) MySQL>quit Bye [[email protected]~]#
MySQL Character Set settings