Chinaunix首页 | 论坛 | 博客
  • 博客访问: 566167
  • 博文数量: 78
  • 博客积分: 2043
  • 博客等级: 大尉
  • 技术积分: 733
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-26 11:52
文章分类

全部博文(78)

文章存档

2011年(5)

2009年(64)

2008年(9)

分类:

2009-07-23 11:24:59

1、查看mysql数据库的编码:


mysql> show variables like 'char%';

+--------------------------+-----------------------------------+

| Variable_name           | Value                            |

+--------------------------+-----------------------------------+

| character_set_client    | gb2312                           |

| character_set_connection | gb2312                           |

| character_set_database  | utf8                             |

| character_set_filesystem | binary                           |

| character_set_results   | gb2312                           |

| character_set_server    | utf8                             |

| character_set_system    | utf8                             |

| character_sets_dir      | D:\MySQLServer5.0\share\charsets\ |

+--------------------------+-----------------------------------+

8 rows in set (0.05 sec)

 

mysql> show variables like 'coll%';

+----------------------+-------------------+

| Variable_name       | Value            |

+----------------------+-------------------+

| collation_connection | gb2312_chinese_ci |

| collation_database  | utf8_general_ci  |

| collation_server    | utf8_general_ci  |

+----------------------+-------------------+

3 rows in set (0.00 sec)

 

 

2、设置mysql数据库的编码

 

编码可以再/etc/my.cnf中更改改完后重新启动。

例如:

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Default to using old password format for compatibility with mysql 3.x

# clients (those using the mysqlclient10 compatibility package).

old_passwords=1

 

default_character_set=utf8                #添加的内容

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

 

##########confluence##############

#default_character_set=utf8

character_set_server=utf8                 


一定要放到mysqld模块下


阅读(1330) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~