mysql编码设置

mysql UTF8设置: 


vi /etc/my.cnf 
[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
default-character-set=utf8  
init_connect='SET NAMES utf8' 


[client] 
default-character-set=utf8 


重启mysql 


登陆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/ | 
+--------------------------+----------------------------+ 

你可能感兴趣的:(mysql,server,database,System,character,variables)