mysql–COLLATION’utf8_general_ci’对CHARACTER SET’二进制’无效?

mysql–COLLATION’utf8_general_ci’对CHARACTER SET’二进制’无效?,第1张

概述mysql> SELECT LOCATE('n', 'München') COLLATE utf8_general_ci; ERROR 1253 (42000): COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'binary' 我该如何摆脱这个错误?我已经尝试过的(复制和粘贴):$

MysqL> SELECT LOCATE("n","München") ColLATE utf8_general_ci;ERROR 1253 (42000): ColLATION 'utf8_general_ci' is not valID for CHaraCTER SET 'binary'

我该如何摆脱这个错误?

我已经尝试过的(复制和粘贴):

$MysqL -u admin -p $DATABASEEnter password:Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MysqL monitor.  Commands end with ; or \g.Your MysqL connection ID is 2Server version: 5.1.69 Source distributioncopyright (c) 2000,2013,Oracle and/or its affiliates. All rights reserved.Oracle is a registered Trademark of Oracle Corporation and/or itsaffiliates. Other names may be Trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MysqL> SELECT LOCATE("n","München") ColLATE utf8_general_ci;ERROR 1253 (42000): ColLATION 'utf8_general_ci' is not valID for CHaraCTER SET 'binary'MysqL> SET nameS utf8;query OK,0 rows affected (0.00 sec)MysqL> SELECT LOCATE("n","München") ColLATE utf8_general_ci;ERROR 1253 (42000): ColLATION 'utf8_general_ci' is not valID for CHaraCTER SET 'binary'MysqL> SELECT LOCATE(_utf8"n",_utf8"München") ColLATE utf8_general_ci;ERROR 1253 (42000): ColLATION 'utf8_general_ci' is not valID for CHaraCTER SET 'binary'MysqL> SHOW VARIABLES liKE "character_set_database";+------------------------+-------+| Variable_name          | Value |+------------------------+-------+| character_set_database | utf8  |+------------------------+-------+1 row in set (0.00 sec)
最佳答案可能服务器已使用二进制的默认字符集进行编译,因此字符串文字正在被解释为,或者客户端设置为在与服务器通信时使用二进制模式.您可以通过调用SET nameS utf8来更改客户端和连接字符集(但如果您的SQL语句是从PHP发出的,则不建议这样做,因为PHP将有自己的命令来设置连接字符集).请参阅MysqL参考手册中的Connection Character Sets and Collations.

或者,您可以使用“introductionrs”明确指定LOCATE函数中用于字符串文字的字符集,例如:

LOCATE(_utf8"n",_utf8"München")

有关详细信息,请参见参考手册第Character String Literal Character Set and Collation页. 总结

以上是内存溢出为你收集整理的mysql – COLLATION’utf8_general_ci’对CHARACTER SET’二进制’无效?全部内容,希望文章能够帮你解决mysql – COLLATION’utf8_general_ci’对CHARACTER SET’二进制’无效?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1168335.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存