重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Windows10下mysql5.5数据库命令行中文乱码怎么办

这篇文章主要介绍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数据库命令行中文乱码怎么办
转载来源:http://cqcxhl.com/article/pgcscg.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP