msyql utf8 中文乱码

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/ |
+————————–+—————————-+
如果有不是utf8的更改my.ini 或my.cnf
[client]中添加
default-character-set=utf8

[mysqld]中添加
character-set-server=utf8
init_connect='SET NAMES utf8'

[mysql]中添加
default-character-set=utf8

然后重启mysql

如果需要临时生效, set 字段 = utf8 例如
set character_set_client = utf8

你可能感兴趣的:(msyql utf8 中文乱码)