mysqli.reconnect = ON 更改连接编码?
如何防止通过重新连接切换连接编码?我的所有设置都是 utf-8,但是由于我在 cli 的 php.ini 中启用了此功能...我已经测试了任何内容...当我有一个很长的工作脚本时,在脚本的任何点上连接已切换,我的数据错误。当我再次禁用它后,一切都很好。但为什么会这样呢?我应该在 my.cfg 中设置什么样的设置来防止连接编码的这种切换?
干杯 尼克
how to prevent switching the connection encoding by reconnect? Everything of my settings are utf-8, but since I have enabled this function in php.ini of the cli ... I have tested anything ... and when I have a long working script then in any point of the script the connection is switched and I have wrong data. After I have disabled it again, then everything is fine. But why is it so? What kind of settings should I set in my.cfg to prevent this switching of the connection encoding?
Cheers
Nik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 MySQL 文档:
charset 命令发出 SET NAMES 语句,还会更改 mysql 在连接断开后重新连接时使用的默认字符集。因此,请发出以下命令:
或者您正在使用的任何字符集(如果不是 UTF8)。这应该可以解决问题。
From the MySQL Docs:
The charset command issues a SET NAMES statement, and also changes the default character set that mysql uses when it reconnects after the connection has dropped. Therefore, issue this:
Or whatever charset you're using (if other than UTF8). This should fix the problem.