我也遇到这个问题,解决了.以下是我的my.cnf配置文件. # Here is entries for some specific programs # The following values assume you have at least 32M ram# The MySQL server [mysqld] port=3306 #socket=MySQL skip-locking default-character-set=gb2312 set-variable = key_buffer=16M set-variable = max_allowed_packet=1M set-variable = thread_stack=128K set-variable = flush_time=1800# Uncomment the following row if you move the MySQL distribution to another # location #basedir = d:/mysql/[mysqldump] quick set-variable = max_allowed_packet=16M[mysql] no-auto-rehash[isamchk] set-variable= key=16M[client_fltk] help_file= d:\mysql\sql_client\MySQL.help client_file= d:\mysql\MySQL.options history_length=20 database = test queries_root= d:\mysql\queries last_database_file= d:\mysql\lastdb 更改 default-character-set=gb2312
select * from table where locate('周',name)=1;名字中含有'菲',则
select * from table where locate('菲',name);
“如果所查询的字段内容包括中文,建议使用gb2312内码重新编译mysql”应该如何做? 呵呵,谢谢谢谢!
# Here is entries for some specific programs
# The following values assume you have at least 32M ram# The MySQL server
[mysqld]
port=3306
#socket=MySQL
skip-locking
default-character-set=gb2312
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
set-variable = flush_time=1800# Uncomment the following row if you move the MySQL distribution to another
# location
#basedir = d:/mysql/[mysqldump]
quick
set-variable = max_allowed_packet=16M[mysql]
no-auto-rehash[isamchk]
set-variable= key=16M[client_fltk]
help_file= d:\mysql\sql_client\MySQL.help
client_file= d:\mysql\MySQL.options
history_length=20
database = test
queries_root= d:\mysql\queries
last_database_file= d:\mysql\lastdb
更改
default-character-set=gb2312
如果是在程序中进行查询,必须把查询语句进行转码,好像mysql(4。0以下)不支持UNicode.
my.ini在windows目录下.
2000下是用my.ini