SQL是Structured Query Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”是不用使用者考虑的。SQL功能强大、简单易学、使用方便,已经成为了数据库操作的基础,并且现在几乎所有的数据库均支持SQL。 重置系统后,很久之前安装的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%';
+--------------------------+---------------------------------------------------------+ |
关键词: Windows10下mysql5.5数据库命令行中文乱码处理方案