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


本文摘自PHP中文网,作者小云云,侵删。

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

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

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


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

[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)

相关推荐:

详解mysql数据库中文乱码问题

MySQL插入数据时遇到中文乱码改怎么办?

php如何解决中文乱码问题?

以上就是Windows10下mysql5.5数据库命令行中文乱码解决方案的详细内容,更多文章请关注木庄网络博客!!

相关阅读 >>

mysql5.5怎么安装不了

mysql5.7.19在windows10下的安装配置以及图文教程

mysql server5.5的安装过程是什么

mysql命令行登录常用操作系统概述

navicat怎么运行命令行

redis怎么通过命令行批量删除key

在mysql5.5中如何查询字符编码?

windows10安装mysql5.7及忘记root密码修改方法

win10忘记mysql密码怎么办

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

更多相关阅读请进入《windows10》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...