时间:2021-07-01 10:21:17 帮助过:3人阅读
先是执行show variables like ‘%char%‘;
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.0\share\charsets\ |
+--------------------------+---------------------------------------------------------+
8 rows in set (0.00 sec)
在MY.INI里添加:
[mysql]
default-character-set=gb2312
[mysqld]
default-character-set=gb2312
然后重新启动MYSQL服务。
进入数据库
alter database charset = gb2312;
还要记得在导入数据库的脚本的前面写上 set names gb2312;
这样就OK了。
alter database 你的数据库名 charset = gb2312;
3、navicat表输入数据乱码
set names ‘gbk‘;
MySQL乱码
标签:sdn var dir 语句 知识 添加 ini 解决 title