mysql中文乱码解决

mac2022-06-30  99

有时服务端显示中文正常,但在客户端却显示?乱码,

首先,系统字符集, echo $LANG

vi .bash_profile 

export $LANG=en_us.utf8

另一个是,

mysql的,my.cnf中如下

mysqld和clients都要加上default-character-set=utf8少一不可。

 

[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysqldefault-character-set=utf8#skip-networkingset-variable=max_allowed_packet=5M#Default to using old password format for compatibility with mysql 3.x# clients (those using the mysqlclient10 compatibility package).default-character-set=utf8old_passwords=1server_id = 2log_bin = mysql-binlog_bin-index=mysql-bin.indexauto_increment_offset=1auto_increment_increment=1#replay-log-index=slave-relay-bin.index#replay-log=slave-replay-bin# Disabling symbolic-links is recommended to prevent assorted security risks;# to do so, uncomment this line:# symbolic-links=0

转载于:https://www.cnblogs.com/woxing/p/3319573.html

相关资源:java插入mysql中文乱码解决
最新回复(0)