在做全文索引的时候,由于mysql编码问题,导致php文件测试时显示乱码,同时中文索引没有用。
查看默认编码 show variables like 'character%'
查看默认排序方式 show variable like 'collation_%'
解决方法:
修改配置文件 /etc/my.cnf
在 [client] 下添加
default-character-set=utf8
[mysqld] 下添加
character-set-server=utf8
33 init_connect='SET NAMES utf8'
修改后重启 mysql 服务 service mysqld restart 即可
再次查看默认编码 show variables like 'character%'
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 | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
查看默认排序
mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
这样 就好了,coreseek的中文索引也可以用了。