mysql在windwos下的乱码问题。
首先找到MySQL安装目录下的my.ini文件,添加以下内容
部分是添加
[client]
default
-
character
-
set
=utf8
[mysqld]
character
-
set
-server=utf8
init_connect=
'SET NAMES utf8'
[mysql]
default
-
character
-
set
=utf8
|
之后,在windows服务中,关闭MySQL服务,并重启。
如果上一步出现问题,可能导致重启失败。
之后cmd进入mysql,执行以下命令即可。
mysql> SHOW VARIABLES
LIKE
'character_set_%'
;
+
--------------------------+---------------------------------------------+
| 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 | XXX\mysql\share\charsets\ |
+
--------------------------+---------------------------------------------+
8
rows
in
set
(0.00 sec)