MySQL character encoding

View current database encoding used

show variables like 'char%';

If character_set_client encoded as latin1, then, can not display Chinese characters, mysql command-line tool to check out the Chinese characters will appear garbled

Modify Character Encoding

You can modify the current character encoding the following command, only for the current session, it will be restored back to the original code after exit

set character_set_results=gb2312;

 

Modify the mysql configuration file character encoding, modify the role of the configuration file to all session, you must restart mysql to take effect

Vim / etc / the my.cnf
 // modify default-character-set encoding characters such as
 @ restart MySQL 
systemctl the restart MySQL

 

Guess you like

Origin www.cnblogs.com/ryanzheng/p/11504074.html