我用一句select * from tmp where basicname="电脑"查找数据,却找不到数据。这是什么原因。
tmp 表数据如下basicname | subname
-------------------------
电脑 | 显示器
mysql安装时候是utf8, basicname 为 text,utf8.
tmp 表数据如下basicname | subname
-------------------------
电脑 | 显示器
mysql安装时候是utf8, basicname 为 text,utf8.
可能是有空格哈哈
可能是在mysql命令行终端运行的吧?
如果是,先运行 set names gbk;
7楼的还不行吗?
所以说你要设置正确的客户端字符集,才可以找到记录。用 SET NAMES