MySQL skip-character-set-client-handshake导致的一个字符集问题
作者:junjie 时间:2024-01-15 11:33:26
今天帮同事处理一个棘手的事情,问题是这样的:
无论在客户机用哪个版本的mysql客户端连接服务器,发现只要服务器端设置了
character-set-server = utf8
之后,
character_set_client、 character_set_connection、character_set_results
就始终都是和服务器端保持一致了,即便在mysql客户端加上选项
--default-character-set=utf8
也不行,除非连接进去后,再手工执行命令
set names latin1
,才会将client、connection、results的字符集改过来。
经过仔细对比,最终发现让我踩坑的地方是,服务器端设置了另一个选项:
skip-character-set-client-handshake
文档上关于这个选项的解释是这样的:
--character-set-client-handshake
Don't ignore character set information sent by the client. To ignore client information and use the default server character set, use --skip-character-set-client-handshake; this makes MySQL behave like MySQL 4.0
这么看来,其实也是有好处的。比如启用 skip-character-set-client-handshake 选项后,就可以避免客户端程序误操作,使用其他字符集连接进来并写入数据,从而引发乱码问题。
标签:MySQL,skip-character-set-client-handshake
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
利用python GDAL库读写geotiff格式的遥感影像方法
2023-08-31 13:15:06
python中实现字符串翻转的方法
2021-06-08 04:27:59
Python Matplotlib实现三维数据的散点图绘制
2021-01-30 09:45:19
![](https://img.aspxhome.com/file/2023/2/87672_0s.jpg)
ASP开发的WAP格式简易邮件系统实例
2008-06-10 17:00:00
![](https://img.aspxhome.com/file/UploadPic/20086/10/2008610172845968s.jpg)
MySQL 如何修改root用户的密码
2024-01-23 19:34:31
python求解水仙花数的方法
2023-10-08 12:07:28
Python查找多个字典公共键key的方法
2022-12-01 09:53:58
数据库高并发情况下重复值写入的避免 字段组合约束
2024-01-21 00:13:31
通俗解释JavaScript正则表达式快速记忆
2024-04-22 22:24:04
![](https://img.aspxhome.com/file/2023/3/135763_0s.png)
ant design中upload组件上传大文件,显示进度条进度的实例
2024-04-27 16:08:46
JS对象数组中如何匹配某个属性值
2024-04-18 09:39:42
![](https://img.aspxhome.com/file/2023/4/136364_0s.png)
浏览器根据什么来判定脚本失控?[译]
2009-02-20 13:36:00
![](https://img.aspxhome.com/file/UploadPic/20092/20/01-50s.jpg)
Python使用pyinstaller实现学生管理系统流程
2023-05-25 02:58:05
![](https://img.aspxhome.com/file/2023/8/79468_0s.png)
Sqlserver 自定义函数 Function使用介绍
2024-01-16 09:11:36
![](https://img.aspxhome.com/file/2023/8/85588_0s.png)
Python多线程编程(三):threading.Thread类的重要函数和方法
2021-04-22 09:02:47
PyTorch零基础入门之逻辑斯蒂回归
2022-09-09 03:44:25
![](https://img.aspxhome.com/file/2023/7/115837_0s.png)
Dephi逆向工具Dede导出函数名MAP导入到IDA中的实现方法
2023-04-09 06:31:40
![](https://img.aspxhome.com/file/2023/8/124358_0s.png)
解决Golang并发工具Singleflight的问题
2024-04-25 15:07:17
![](https://img.aspxhome.com/file/2023/1/134201_0s.png)
避免使用滤镜
2009-10-13 20:30:00
python计算机视觉opencv卡号识别示例详解
2023-04-14 13:58:25
![](https://img.aspxhome.com/file/2023/6/105306_0s.png)