- Rongsen.Com.Cn 版权所有 2008-2010 京ICP备08007000号 京公海网安备11010802026356号 朝阳网安编号:110105199号
- 北京黑客防线网安工作室-黑客防线网安服务器维护基地为您提供专业的
服务器维护
,企业网站维护
,网站维护
服务 - (建议采用1024×768分辨率,以达到最佳视觉效果) Powered by 黑客防线网安 ©2009-2010 www.rongsen.com.cn
作者:黑客防线网安MYSQL教程网 来源:黑客防线网安MYSQL教程网 浏览次数:0 |
通过修改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)
我要申请本站:N点 | 黑客防线官网 | |
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479 |