最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Windows10下mysql5.5数据库命令行中文乱码解决方案

来源:动视网 责编:小采 时间:2020-11-09 08:44:52
文档

Windows10下mysql5.5数据库命令行中文乱码解决方案

Windows10下mysql5.5数据库命令行中文乱码解决方案:重置系统后,很久之前安装的MySQL数据库出现了控制台查询中文乱码问题,本文主要和大家分享Windows10下mysql5.5数据库命令行中文乱码解决方案,希望能帮助到大家。打开安装目录下的my.ini文件我的是:C:\Program Files\MySQL\MySQL Serv
推荐度:
导读Windows10下mysql5.5数据库命令行中文乱码解决方案:重置系统后,很久之前安装的MySQL数据库出现了控制台查询中文乱码问题,本文主要和大家分享Windows10下mysql5.5数据库命令行中文乱码解决方案,希望能帮助到大家。打开安装目录下的my.ini文件我的是:C:\Program Files\MySQL\MySQL Serv


重置系统后,很久之前安装的MySQL数据库出现了控制台查询中文乱码问题,本文主要和大家分享Windows10下mysql5.5数据库命令行中文乱码解决方案,希望能帮助到大家。

打开安装目录下的my.ini文件

我的是:C:\Program Files\MySQL\MySQL Server 5.5下面,修改如下:

[client]
default-character-set=utf8
port=3306
[mysql]
#网上下面这个 gbk 很多回答也是设置为utf8,结果就是乱码
default-character-set=gbk
# SERVER SECTION
# ----------------------------------------------------------------------
## The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.5/"
#Path to the database root
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8
collation-server=utf8_general_ci
修改完毕重启mysql,查看一下编码:
mysql> show variables like 'character_set%';
+--------------------------+---------------------------------------------------------+| 
Variable_name | Value |
+--------------------------+---------------------------------------------------------+|
 character_set_client | gbk || 
character_set_connection | gbk ||
 character_set_database | utf8 || 
character_set_filesystem | binary || 
character_set_results | gbk || 
character_set_server | utf8 ||
 character_set_system | utf8 ||
 character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\ |
+--------------------------+---------------------------------------------------------+
操作试试:
mysql> insert into per values('乱码解决');
Query OK, 1 row affected (0.00 sec)
mysql> select * from per;
+--------------+| 
name |
+--------------+| 
的纷纷从 ||
 乱码解决 |
+--------------+
3 rows in set (0.00 sec)

文档

Windows10下mysql5.5数据库命令行中文乱码解决方案

Windows10下mysql5.5数据库命令行中文乱码解决方案:重置系统后,很久之前安装的MySQL数据库出现了控制台查询中文乱码问题,本文主要和大家分享Windows10下mysql5.5数据库命令行中文乱码解决方案,希望能帮助到大家。打开安装目录下的my.ini文件我的是:C:\Program Files\MySQL\MySQL Serv
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top