windows中mysql默认字符集修改字符编码设置中文乱码_MySQL数据库_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

windows中mysql默认字符集修改字符编码设置中文乱码

作者:黑客防线网安MYSQL教程网 来源:黑客防线网安MYSQL教程网 浏览次数:0

本篇关键词:windowsmysql乱码
黑客防线网安网讯:windows中mysql5.5.10默认字符集修改,字符编码设置,中文乱码,gb2312,gbk,utf8格式存储数据
通过修改mysql默认字符集,可以存储中文数据,以免出现中文乱码,以下以设置为utf8为例。
windows中mysql5.5.10默认字符集修改字符编码设置中文乱码,gb2312,gbk,utf8格式存储数据

通过修改mysql默认字符集,可以存储中文数据,以免出现中文乱码,以下以设置为utf8为例

=================================================================================

以下内容是在本机安装的mysql-5.5.10上,没有修改my.ini前显示结果
===================================================================================

 mysql> show variables like 'character%';
+--------------------------+---------------------------------+
| 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       | D:\mysql-5.5.10\share\charsets\ |
+--------------------------+---------------------------------+
8 rows in set (0.02 sec)

mysql> show variables like 'collation%';
+----------------------+-------------------+
| Variable_name        | Value             |
+----------------------+-------------------+
| collation_connection | gbk_chinese_ci    |
| collation_database   | latin1_swedish_ci |
| collation_server     | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)

 

==============================================================================

关闭mysql服务,在mysql安装目录下,my.ini文件进行如下修改,没有则直接进行添加
==============================================================================

[client]
#修改客户端默认字符编码格式为utf8
default-character-set=utf8
[mysqld]
#修改服务器端默认字符编码格式为utf8
character-set-server = utf8

 

=============================================================================

修改后,再次输入命令查看,显示结果如下
==============================================================================

mysql> show variables like 'character%';
+--------------------------+---------------------------------+
| Variable_name            | Value                           |
+--------------------------+---------------------------------+
| character_set_client     | utf8                            |
| character_set_connection | utf8                            |
| character_set_database   | utf8                            |
| character_set_filesystem | binary                          |
| character_set_results    | utf8                            |
| character_set_server     | utf8                            |
| character_set_system     | utf8                            |
| character_sets_dir       | D:\mysql-5.5.10\share\charsets\ |
+--------------------------+---------------------------------+
8 rows in set (0.00 sec)

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-19692-1.html
网站维护教程更新时间:2013-04-27 10:59:49  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer